During the render response phase of the first request, 
#{backing.project.description} will be rendered as the value of [EMAIL 
PROTECTED] if #{backing.renderMode eq 'edit'} .

However the value for [EMAIL PROTECTED] (coming back from the browser) will not 
be assigned back to #{backing.project.description} if #{backing.renderMode eq 
'edit'} is false during the second request.  This is probably the case if 
#{backing} is in request scope and the renderMode property is not initialized 
to 'edit' .

In other words, it sounds as though you want backing.renderMode to be a 
"conversation piece" .  Apparently the hidden input field is accomplishing this 
for you.  You may want to look into t:saveState as an alternative.

Also note that the call to getDescription() is going to happen whether 
#{backing.renderMode eq 'edit'} or #{not empty backing.project and 
backing.renderMode eq 'view'}" evaluate to true during the render response 
phase of any request.  This is because #{backing.project.description} is set 
for @value for both the inputText and the outputText.  You may have to read 
this more than once ;)

>-----Original Message-----
>From: Laurie Harper [mailto:[EMAIL PROTECTED]
>Sent: Thursday, January 5, 2006 04:01 PM
>To: [email protected]
>Subject: model update failing, I can't see why
>
>I have this really weird problem I can't explain. I'm hoping someone can
>give me some insight. The problem is that my backing bean isn't being
>updated properly during the update model phase, *unless* I include a
>hidden input. With the source listed below it works fine, but if I
>remove the h:inputHidden I get a call to getDescription() instead of
>setDescription().
>
>The action for the h:commandButton fires, but because the model hasn't
>been updated it has no effect. Here's the code:
>
>
><h:commandButton value="#{msgs['label.Save']}"
>     action="#{backing.save}"/>
>
><h:inputText id="description"
>     value="#{backing.project.description}"
>     rendered="#{backing.renderMode eq 'edit'}"/>
>
><h:inputHidden id="mode" value="edit"
>     rendered="#{backing.renderMode eq 'edit'}"/>
>
><h:outputText
>     value="#{backing.project.description}"
>     rendered="#{not empty backing.project
>                 and backing.renderMode eq 'view'}"/>
>
>
>As I say, as long as I have that hidden input everything's fine. I have 
>an h:messages in my view and it's not showing any conversion or
>validation errors, with or without the hidden input.
>
>I don't understand :-( Any help would be appreciated!
>
>L.
>
>


Reply via email to