h:commandLink is not working within h:dataTable

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.

[1059 byte] By [vinuthamla] at [2007-11-26 18:52:29]
# 1

Most probably the data list is just null in the next view.

Fix this:// in bean constructor (will be loaded everytime during instantiation):

public PmsPatientWebGuiListBean() {

loadPmsPatients();

}

// or in initialization block (will be loaded everytime after instantiation):

{

loadPmsPatients();

}

// or in the getter of the list (wil be loaded every view of the datatable):

public List getPmsPatients() {

if (pmsPatients == null) {

loadPmsPatients();

}

return pmsPatients;

}

BalusCa at 2007-7-9 6:26:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

when i click a command Link,

<h:commandLink action="#{pmsPatientWebGuiListBean.select}" >

and in the "select" method of bean class, i am giving one println statement which is not displaying in the command prompt.

ie, its not going to method #{pmsPatientWebGuiListBean.select}

Thanks,

Vinutha.

vinuthamla at 2007-7-9 6:26:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
As I don't see any results, may I conclude that you haven't even tried my suggestions?
BalusCa at 2007-7-9 6:26:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Hi BalusC , Thanks for your response,I solved that problem by keeping managed bean under session.Thanks,Vinutha.
vinuthamla at 2007-7-9 6:26:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
This is the easiest solution, yes.Let I say so: I hope you have designed your webapp well =)
BalusCa at 2007-7-9 6:26:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...