facebook

h:inputText not setting value for managed bean property

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #260100 Reply

    Asia
    Member

    I have noticed that using h:inputText tag on a JSF page does not set the property value in the manged bean after the value is modified on the web page.

    If I set the initial value, it is displayed on the form, if I set validator method on this field it is called, if I set valueChangeListener method it is called, the action method on the button is called, it all seam to be working fine except that when I modify field value through the page the set method on the property is not called (with or without validator and valueChangeListener defined). What am I missing here?

    I also noticed that in the source mode, the property sheet for the h:inputText has the following attribute ‘Initial text’ which when set generates the ‘value’ attribute of the h:inputText. Essentially there is no ‘value’ attribute on the property sheet. It might be be just the wrong label on the property sheet, or it may be that the only way to set the property value is by calling the valueChangeListener method. Which way is it?

    I have the following code:

     home.jsp:
    
    <h:inputText id="questionDescription" value="#{Question.longQuestionDscr}"></h:inputText>
    
    <h:commandButton value="#{bundle.preview_button}"
        action="#{Question.previewForm}" immediate="true">
    </h:commandButton>
    
    
    QuestionBean.java:
    private String longQuestionDscr;
    public String getLongQuestionDscr() {
            return longQuestionDscr;
        }
    public void setLongQuestionDscr(String longQuestionDscr) {
            this.longQuestionDscr = longQuestionDscr;
        }
    faces-config.xml:
    
    <managed-bean>
        <managed-bean-name>Question</managed-bean-name>
        <managed-bean-class>
                com.mycomp.jsf.QuestionBean
        </managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    
        <managed-property>
            <property-name>longQuestionDscr</property-name>
            <property-class>java.lang.String</property-class>
            <null-value></null-value>
        </managed-property>
    </managed-bean>
    

    BTW, I run the JSFLoginDemo example to see if that one would behave any differently and no luck there, it seam that setUserName is not called after entering userName.

    – System Setup ——————————-
    *** Date: Mon Oct 09 22:20:01 PDT 2006

    *** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.4.2_12

    *** MyEclipse details:
    MyEclipse Enterprise Workbench

    Version: 5.0 GA
    Build id: 20060805-5.0-GA

    *** Eclipse details:
    MyEclipse Enterprise Workbench

    Version: 5.0.1 GA
    Build id: 20060810-5.0.1-GA

    Eclipse Platform

    Version: 3.2.1.r321_v20060921-b_XVA-INSQSyMtx
    Build id: M20060629-1905

    Eclipse Java Development Tools

    Version: 3.2.1.r321_v20060905-R4CM1Znkvre9wC-
    Build id: M20060921-0945

    Eclipse Project SDK

    Version: 3.2.1.r321_v20060801-tQ1w49KnTArT0FZ
    Build id: M20060921-0945

    Eclipse RCP

    Version: 3.2.1.r321_v20060801-2ekW2BxmcpPUOoq
    Build id: M20060629-1905

    Eclipse Plug-in Development Environment

    Version: 3.2.1.r321_v20060823-6vYLLdQ3Nk8DrFG
    Build id: M20060921-0945

    Eclipse Graphical Editing Framework

    Version: 3.2.0.v20060626
    Build id: 20060627-0816

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    e38_74
    -product
    com.genuitec.myeclipse.product.ide
    -vm
    C:\j2sdk1.4.2_12\bin\javaw.exe

    Message Body ——————————-
    Here is a message I found in the log (not sure if realted):
    !ENTRY org.eclipse.ui 4 4 2006-10-09 22:04:29.812
    !MESSAGE Unhandled event loop exception

    !ENTRY org.eclipse.ui 4 0 2006-10-09 22:04:30.640
    !MESSAGE Widget is disposed
    !STACK 0
    org.eclipse.swt.SWTException: Widget is disposed
    at org.eclipse.swt.SWT.error(SWT.java:3374)
    at org.eclipse.swt.SWT.error(SWT.java:3297)
    at org.eclipse.swt.SWT.error(SWT.java:3268)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:435)
    at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:330)
    at org.eclipse.swt.widgets.Scrollable.getClientArea(Scrollable.java:151)
    at com.genuitec.eclipse.webdesigner3.properties.ElementList.resizeColumns(ElementList.java:310)
    at com.genuitec.eclipse.webdesigner3.properties.ElementList$3.run(ElementList.java:192)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)

    !ENTRY org.eclipse.ui 4 4 2006-10-09 22:04:30.718
    !MESSAGE Unhandled event loop exception

    !ENTRY org.eclipse.ui 4 0 2006-10-09 22:04:30.734
    !MESSAGE Widget is disposed
    !STACK 0
    org.eclipse.swt.SWTException: Widget is disposed
    at org.eclipse.swt.SWT.error(SWT.java:3374)
    at org.eclipse.swt.SWT.error(SWT.java:3297)
    at org.eclipse.swt.SWT.error(SWT.java:3268)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:435)
    at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:330)
    at org.eclipse.swt.widgets.Scrollable.getClientArea(Scrollable.java:151)
    at com.genuitec.eclipse.webdesigner3.properties.ElementList.resizeColumns(ElementList.java:310)
    at com.genuitec.eclipse.webdesigner3.properties.ElementList$3.run(ElementList.java:192)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)

    !ENTRY org.eclipse.wst.validation 4 0 2006-10-09 22:04:42.015
    !MESSAGE
    *** ERROR ***: Mon Oct 09 22:04:42 PDT 2006 org.eclipse.wst.validation.internal.core.ValidationException: IWAE0053E An internal error has occurred running validation on project:SIPS Enterprise]:SIPS Enterprise, check the log file for details
    at org.eclipse.jst.j2ee.model.internal.validation.EarValidator.validateInJob(EarValidator.java:165)
    at org.eclipse.jst.j2ee.internal.validation.UIEarValidator.validateInJob(UIEarValidator.java:217)
    at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

    !ENTRY org.eclipse.wst.validation 4 0 2006-10-09 22:04:42.031
    !MESSAGE
    *** ERROR ***: Mon Oct 09 22:04:42 PDT 2006 org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: META-INF/application.xml
    Stack trace of nested exception:
    org.eclipse.jst.j2ee.commonarchivecore.internal.exception.EmptyResourceException: platform:/resource/SIPS Enterprise/EarContent/META-INF/application.xml
    at org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil.getRoot(ArchiveUtil.java:395)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.XmlBasedImportStrategyImpl.primLoadDeploymentDescriptor(XmlBasedImportStrategyImpl.java:42)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.Ear12ImportStrategyImpl.loadDeploymentDescriptor(Ear12ImportStrategyImpl.java:87)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.Ear12ImportStrategyImpl.importMetaData(Ear12ImportStrategyImpl.java:81)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EARFileImpl.getDeploymentDescriptor(EARFileImpl.java:296)
    at org.eclipse.jst.j2ee.model.internal.validation.EarValidator.validateInJob(EarValidator.java:142)
    at org.eclipse.jst.j2ee.internal.validation.UIEarValidator.validateInJob(UIEarValidator.java:217)
    at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

    !ENTRY org.eclipse.wst.validation 4 0 2006-10-09 22:04:47.531
    !MESSAGE
    *** ERROR ***: Mon Oct 09 22:04:47 PDT 2006 org.eclipse.wst.validation.internal.core.ValidationException: IWAE0053E An internal error has occurred running validation on project:SIPS Enterprise]:SIPS Enterprise, check the log file for details
    at org.eclipse.jst.j2ee.model.internal.validation.EarValidator.validateInJob(EarValidator.java:165)
    at org.eclipse.jst.j2ee.internal.validation.UIEarValidator.validateInJob(UIEarValidator.java:217)
    at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

    !ENTRY org.eclipse.wst.validation 4 0 2006-10-09 22:04:47.562
    !MESSAGE
    *** ERROR ***: Mon Oct 09 22:04:47 PDT 2006 org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DeploymentDescriptorLoadException: META-INF/application.xml
    Stack trace of nested exception:
    org.eclipse.jst.j2ee.commonarchivecore.internal.exception.EmptyResourceException: platform:/resource/SIPS Enterprise/EarContent/META-INF/application.xml
    at org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil.getRoot(ArchiveUtil.java:395)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.XmlBasedImportStrategyImpl.primLoadDeploymentDescriptor(XmlBasedImportStrategyImpl.java:42)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.Ear12ImportStrategyImpl.loadDeploymentDescriptor(Ear12ImportStrategyImpl.java:87)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.Ear12ImportStrategyImpl.importMetaData(Ear12ImportStrategyImpl.java:81)
    at org.eclipse.jst.j2ee.commonarchivecore.internal.impl.EARFileImpl.getDeploymentDescriptor(EARFileImpl.java:296)
    at org.eclipse.jst.j2ee.model.internal.validation.EarValidator.validateInJob(EarValidator.java:142)
    at org.eclipse.jst.j2ee.internal.validation.UIEarValidator.validateInJob(UIEarValidator.java:217)
    at org.eclipse.wst.validation.internal.operations.ValidatorJob.run(ValidatorJob.java:70)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

    !ENTRY com.genuitec.eclipse.webdesigner3 1 0 2006-10-09 22:06:02.968
    !MESSAGE Unable to synchronize source selection.

    #260183 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    Asia, are you using Sun RI or MyFaces right now? The first thing I do when using JSF on a project, when I run into a *very* obscure bug like this is upgrade my JSF libraries. JSF 1.0 and initial RI 1.1 releases were so buggy for me that running into behaviors like this was the norm, rather than the exception. Just recently I was working on a JSF 1.2 application (on Glassfish) and ran into almost no bugs which was nice. But before we go too far really racking your brain try and see if this is a) a caching issue or b) a bug. Have you tried other browsers? Are you using client or server save state?

    #260219 Reply

    Asia
    Member

    I hate to report this, but I tried Sun’s JSF 1.1 and 1.2 and MyFace 1.1 and I haven’t seen any difference in behavior. I have been saving state on client and Also I tried saving state on server, again no difference in behavior. Still the same problem exists.

    #260237 Reply

    Riyad Kalla
    Member

    well that is certainly strange… so the behavior is:

    1) Fill out form
    2) Submit
    3) Hit back
    4) Change some value, like username
    5) Resubmit

    And the value in the managed bean is still the value from step #2?

    #260282 Reply

    Asia
    Member

    Problem is solved. I had a ‘immediate’ attribute on the form button set to True. This prevented properties of the managed bean from being set. After removing the attribute it all works fine.

    Thanks for the assistance.

    #260296 Reply

    Entry
    Member

    i have the same problem.
    could you describe the exact steps for resolving the problem?
    i can’t seem to find the right options.

    thanks

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: h:inputText not setting value for managed bean property

You must be logged in to post in the forum log in