Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

h:commandLink is not working within h:dataTable

 
vinutha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my xhtml page, i am using h:dataTable like this,
After clicking Search button, i will get list of patients based on FirstName and LastName.
<h:inputText value="#{pmsPatientWebGuiListBean.firstName}" />
<h:inputText value="#{pmsPatientWebGuiListBean.lastName}" />
<h:commandButton value="Search"
action="#{pmsPatientWebGuiListBean.searchPatient}"/>
<h:dataTable id="adresstable"
value="#{pmsPatientWebGuiListBean.pmsPatients}"
var="patient">
<h:column id="firstname">
<f:facet name="header">
<hutputText value="First Name" />
</f:facet>
<h:commandLink action="#{pmsPatientWebGuiListBean.select}" >
<hutputText value="#{patient.firstName}" />
</h:commandLink>
</h:column>
</h:dataTable>

but when i click command link of first name, its not goint to #{pmsPatientWebGuiListBean.select} action.

How to resolve this,
Thanks,
Vinutha.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you put your code within the

<h:form>
</h:form>

tags.

I experience sometimes that the <h:commandbutton> is not working when it's not within a form.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I see it's the <h:commandLink />

This is also certain true with the <h:commandLink> button because it's submits the enclosing form.
 
vinutha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi wilhelm,

Thanks for your reply.
I have included <h:commandLink /> within <h:form></h:form>.
even though its not identifying action method under bean class.

Thanks,
Vinutha.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the following link.

Maybe you can find the solution in here

Sun Developer Network "dataTable and commandLink not working together"

I've tried the combination within dataTable and commandLink and it worked.
 
vinutha
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi wilhelm,

Thanks for your response,
I solved that problem by keeping managed bean under session.

Thanks,
Vinutha.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64701
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"vinutah ml", you have previously been warned on one or more occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Be aware that accounts with invalid display names are removed.

bear
JavaRanch Sheriff
 
Scott Selikoff
author
Saloon Keeper
Posts: 4010
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"vinutha"

Your name is still not correct. Please review the naming policy and update it. This is your third and final warning.
 
Brian Moran
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vinutha wrote:Hi,

In my xhtml page, i am using h:dataTable like this,
After clicking Search button, i will get list of patients based on FirstName and LastName.
<h:inputText value="#{pmsPatientWebGuiListBean.firstName}" />
<h:inputText value="#{pmsPatientWebGuiListBean.lastName}" />
<h:commandButton value="Search"
action="#{pmsPatientWebGuiListBean.searchPatient}"/>
<h:dataTable id="adresstable"
value="#{pmsPatientWebGuiListBean.pmsPatients}"
var="patient">
<h:column id="firstname">
<f:facet name="header">
<hutputText value="First Name" />
</f:facet>
<h:commandLink action="#{pmsPatientWebGuiListBean.select}" >
<hutputText value="#{patient.firstName}" />
</h:commandLink>
</h:column>
</h:dataTable>

but when i click command link of first name, its not goint to #{pmsPatientWebGuiListBean.select} action.

How to resolve this,
Thanks,
Vinutha.


The only way I've been able to get commandlinks to work inside of a datatable is to set the scope of the backing bean to session in faces-config. Try that out and see if it works for you.
 
Frank S Liu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is still not working for me.

I put the h:commandLink inside h:form tags, and my backing bean is session scoped, but it is not responding.

Can someone please advise?

Thank you
Frank
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic