myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-749) inputText refresh problem
Date Wed, 26 Oct 2005 19:29:56 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-749?page=comments#action_12356007 ] 

Mike Kienenberger commented on MYFACES-749:
-------------------------------------------

JagMohan,

Thanks for the simple example.
This is the exact same situation that's being discussed on the MyFaces-User mailing list with
the subject as "Help still needed with valueChangeListener"

Your example did allow me to quickly test my suspicions, however.

The answer (which I will also post to that thread) is that renderers for EditableValueHolders
(and everything that inherits from UIInput is an EVH) render the submittedValue of the component
if that value is not null.

The submitted value is only set to null if the component successfully validates.   By marking
your pulldown component as immediate, then short-circuiting the process by calling renderResponse(),
you force the inputText component to always render the submitted value.

So you need to not only update the backing bean, but also the submittedValue for the backing
bean.   However, it might be sufficient to just set the submittedValue of the dependent component
(inputText in this case) to null, which will probably force the inputText component to render
the value from the backing bean.   But it might render the local value of the component instead
-- I really don't know.   But in any case, you have to change the submittedValue of the dependent
component.

As I said before, this isn't a bug.  It's a lack of understanding of how JSF works.  That's
not surprising since the whole process gets very complicated once you start using immediate.
  Even I didn't guess correctly -- I thought the renderer would grab the backing bean value
for non-validated components.  However, if you're going to use immediate, you're going to
have to do a lot more digging to determine what's really going on.


> inputText refresh problem
> -------------------------
>
>          Key: MYFACES-749
>          URL: http://issues.apache.org/jira/browse/MYFACES-749
>      Project: MyFaces
>         Type: Bug
>   Components: General
>     Versions: 1.1.0, 1.0.9m9
>  Environment: Windows XP, Tomcat5.x
>     Reporter: JagMohan
>  Attachments: RequestQueueBean.java, faces-config.xml, test.jsp
>
> I have a drop down LEVELS with an valueChangeListener and an inputText field that is
supposed to change when the drop down is changed. The inputText field is bound to a simple
String object.
> When the value of the drop down changes, request submits and upon processing the value
of the backing bean changes. when comes to UI, its not showing the changed value in the <h:inputText>
field, but its showing the updated value in <h:outputText> field.
> REFERENCES
> ---------------------
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
>          <h:selectOneMenu id="SELECTlevel" 
> 	immediate="true"
> 	value="#{irisRequestQueueBean.currentRequest.level}"
> 	disabled="#{empty irisRequestQueueBean.levels}"
> 	valueChangeListener="#{irisRequestQueueBean.changedLevel}"
> 	onchange="this.form.submit( );">
> 	<f:selectItems value="#{irisRequestQueueBean.levels}" />
> 	<j4j:idProxy id="levelId" />
>        </h:selectOneMenu>
> upon changing the level, backing bean value changes. but the below inputText not showing
the updated value. but outputText is showing the correct value.
>      <h:inputText id="checked" size="30" value="#{irisRequestQueueBean.currentRequest.title}">

>      </h:inputText>
>     <h:outputText value="(#{irisRequestQueueBean.currentRequest.title})"/>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message