• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Action method not getting called inside the dataTable

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends

I am having trouble in calling the action method from command link inside datatable.

The code of the DataTable is

<h:dataTable id="siteDetailTable1" value="#{siteRequirementBean.detailHeadQuarterList}" var="details" cellpadding="1" cellspacing="1" width="100%">
<h:column>
<h:panelGrid columns="1" width="100%" columnClasses="none,tableRowOdd" rowClasses="tableRowEven,tableRowOdd">
<h:panelGroup>
<h:outputText value="Name: " />
<h:outputText value="#{details.name}" style="width: 55%" />
</h:panelGroup>
<h:panelGroup>
<h:outputText value="Location: " />
<h:outputText value="#{details.location}" style="width: 55%" />
</h:panelGroup>
<h:panelGroup>
<h:outputText value="Description: " />
<h:outputText value="#{details.description}" style="width: 55%" />
</h:panelGroup>
</h:panelGrid>
</h:column>
<h:column>
<h:commandLink action="#{requirementDisplay.viewDetailedRequirement}">
<h:outputText value="VDR" />
</h:commandLink>
</h:column>
</h:dataTable>

The managed beans siteRequirementBean & requirementDisplay both are in request scope.

The datatable has two columns. In the first column there 3 labels which displays some information. In the second column there is a command link. This command link is binded with an action method of managed bean. The page gets displayed with all the components including the commandlink , but on clicking the command link the action method is not getting called. The page gets refreshed & comes back again.

Infact I tried putting in arbitrary string in the action method�s name attribute of command link. There was no error & the page came back again on clicking the link.
If the same command link is kept outside data table then the action method gets called.

Command Button also shows the same behavior as command link.

Please give your valuable inputs�..

Thanks in Advance
Amit
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
change your managed bean scope from "request" to "session"
 
Amit Nair
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Richard for your reply !!!

I changed the scope of bean from request to session. Now the action method is getting called. But I found that both the beans(siteRequirementBean &
requirementDisplay) needs to be in session scope. But the command link is only calling the action method of requirementDisplay bean. So when only
requirementDisplay is kept in session scope, action method is not getting called. Also my whole application is built on the top of logic that the bean would be in request scope. So changing the scope of bean from request to session would be night mare & real problem. So can you please tell me is there any other way out of it� Also one of my page is having the data table with the bean in request scope & it's calling the action method without any problem. But I am unable to figure out as what is getting wrong here....

Thanks
Amit
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you populating the datatable values? The values become garbaged after one request.

This might help:


[ December 01, 2006: Message edited by: Bauke Scholtz ]
 
grapes are vegan food pellets. Eat this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic