Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Does the 'rendered' attribute prevent postback of vars?  RSS feed

 
Florian Jung
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
I am new to JSF and I am facing a problem that I am not sure how to solve, thus asking my question in this forum:

I have a list of names in a datatable. The names' origin is a managed bean bound to the session context. The names itself are wrapped in an own class.

The names are shown in the table the way they should. Now I planned to place a command link adjacent to each name labeled with "edit". By clicking on this command link the respective entry should be rendered as a text input form element. The "edit" link then should be replaced with a "save" command link. So far I have done it like that:

<t:inputText id="produkt" value="#{obj.name}" styleClass="text" style="width: 450px" rendered="#{obj.editable}"/>
<tutputText id="produkt" value="#{obj.name}" rendered="#{!obj.editable}"/>

As you can see, depending on the flag 'editable' the name will be rendered as text or as a form element. By pressing the 'save' link, the form element's value should be stored in the database and the flag indicating that this name is editable should be reset to false.

The described scenario works except for that the name (the object's property) is not set to the new value. As soon as I remove the rendered attributes so that the form input element is visible all the time, the whole thing works as it is supposed to.

I have bound the method which does the storing as an action listener as well as an action method. Both resulted in the same behaviour.

Thus my first question is if I missed something regarding the JSF lifecycle or the way the rendered element affects the postback. By the way - the same happens if I use the readonly attribute instead of the rendered attribute.

I hope there is someone who can help me.

Many thank in advance,
Florian
 
Ronald Aguilar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the same problme that I resolve by looking at the log.debug obj.editable and observe how it changes value to true and false depending on the alogrothym of the codes.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!