• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

h:commandLink is not working within h:dataTable

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
<h:outputText value="First Name" />
</f:facet>
<h:commandLink action="#{pmsPatientWebGuiListBean.select}" >
<h:outputText 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.
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi wilhelm,

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

Thanks,
Vinutha.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
<h:outputText value="First Name" />
</f:facet>
<h:commandLink action="#{pmsPatientWebGuiListBean.select}" >
<h:outputText 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic