This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSF and the fly likes commandButton/commandLink not working inside datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "commandButton/commandLink not working inside datatable" Watch "commandButton/commandLink not working inside datatable" New topic
Author

commandButton/commandLink not working inside datatable

Ganesh Podaralla
Greenhorn

Joined: Feb 22, 2010
Posts: 23
Hi Ranchers,

My Facelets .xhtml is typically as below.

<h:form>

<h:dataTable value="#{bean.valueList}" var="value" rows="15">
<h:column>
<h:inputText id="text" value="#{value.text}" />
</h:column>
<h:column>
<h:commandButton value="Go" action="#{bean.action}" >
<f:setPropertyActionListener value="#{value}" target="#{bean.value}" />
</h:commandButton>
</h:column>
</h:datatable>
</h:form>

The rows are displayed along with the Go buttons properly. But when I click on "Go" button, the action method on the bean is not invoked. Also, the "value" property in the bean is not set. The commandButtons placed outside the datatable (and inside h:form) are invoked correctly. The bean is in request scope. Please let me know what could be the issue and the resolution using JSF/RichFaces.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
You need <a4j:keepAlive bean="#{bean}" />

my guess is you have the bean in request scope?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: commandButton/commandLink not working inside datatable
 
Similar Threads
dataTable & commandLink problem
getWrappedData does not return right value
Submit dataTable fields
inserting several rows in DB using h:datatable
<h:commandLink> is not able to invoke backing bean method