You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by m4rkuz <m4...@gmail.com> on 2008/09/09 16:24:39 UTC
Problem with h:commandLink in t:dataTable
Hi Everyone,
I have a little big problem, I got a CRUD like app, in the main form I have
a data table that shows the result of a query and every row has a link to
jump to the edit page, everything works fine, until I try to go to the next
page *h:commandLink action="#{backingBean.edit}" *with the selected row so
I can edit it, the problems kicks in when I remove a line of code that I
have in the getObjectList method
*
**objectList = manager.findAll(); *
>
> I remove it because I need that the main page doesn't show anything until
> the search button is clicked, after this modification the links stop
> working, I cannot get to the nex page, in Debug mode I see I don't even get
> to the edit() methond in the backing bean, is like the bean is recreated
> before the action of the h:commandLink kicks and then the table data and the
> row are null so they don't fire any event :S
>
> The BackingBean scope is Request (it work with session scope but I don't
> think is necesary to hold on that bean for a whole session )
> and I have try with* <f:param* , *<f:attribute*, *
> <f:setPropertyActionListener* all works untill I remove that line....
>
>
> *What Can I do??*
>
> Code below..
> * <t:dataTable id="perfilesTable"
> width="100%" border="0" rows="20"
> cellpadding="5" cellspacing="1"
> value="#{backingBean.objectList}"
> var="selectedRow" rowClasses="row1,
> row2" headerClass="tableHead">
> <t:column>
> <f:facet name="header">
> <h:outputText
> value="Perfiles"/>
> </f:facet>
> <h:commandLink
> action="#{backingBean.edit}" value="#{selectedRow.name}"
> actionListener="#{backingBean.editAction}">
> <f:attribute
> name="attributeName1" value="#{selectedRow}" />
> </h:commandLink>
> </t:column>
> <t:column>
> <f:facet name="header">
> <h:outputText
> value="Active"/>
> </f:facet>
> <h:outputText
> value="#{selectedRow.active}"/>
> </t:column>
> </t:dataTable>
> *
>
> PD: I'm totally sory I post this same question in a ongoing thread I just
> forgot to clear the subject
>
>
> Marcus V. Sánchez D.
> ______________________
> Enterprise Developer.
> Sun Certified Java Programmer (SCJP)
>
RE: Problem with h:commandLink in t:dataTable
Posted by Vinaya Tirikkovalluru <vi...@converge.com>.
Hi,
Is the backing bean in session scope or Request scope?
If you have the backing bean in request scope, the bean will be re created after your search.
Not sure, if this makes sense
Vinaya
________________________________
From: m4rkuz [mailto:m4rkuz@gmail.com]
Sent: Tuesday, September 09, 2008 10:25 AM
To: MyFaces Discussion
Subject: Problem with h:commandLink in t:dataTable
Hi Everyone,
I have a little big problem, I got a CRUD like app, in the main form I have a data table that shows the result of a query and every row has a link to jump to the edit page, everything works fine, until I try to go to the next page h:commandLink action="#{backingBean.edit}" with the selected row so I can edit it, the problems kicks in when I remove a line of code that I have in the getObjectList method
objectList = manager.findAll();
I remove it because I need that the main page doesn't show anything until the search button is clicked, after this modification the links stop working, I cannot get to the nex page, in Debug mode I see I don't even get to the edit() methond in the backing bean, is like the bean is recreated before the action of the h:commandLink kicks and then the table data and the row are null so they don't fire any event :S
The BackingBean scope is Request (it work with session scope but I don't think is necesary to hold on that bean for a whole session )
and I have try with <f:param , <f:attribute, <f:setPropertyActionListener all works untill I remove that line....
What Can I do??
Code below..
<t:dataTable id="perfilesTable" width="100%" border="0" rows="20"
cellpadding="5" cellspacing="1" value="#{backingBean.objectList}"
var="selectedRow" rowClasses="row1, row2" headerClass="tableHead">
<t:column>
<f:facet name="header">
<h:outputText value="Perfiles"/>
</f:facet>
<h:commandLink action="#{backingBean.edit}" value="#{selectedRow.name}" actionListener="#{backingBean.editAction}">
<f:attribute name="attributeName1" value="#{selectedRow}" />
</h:commandLink>
</t:column>
<t:column>
<f:facet name="header">
<h:outputText value="Active"/>
</f:facet>
<h:outputText value="#{selectedRow.active}"/>
</t:column>
</t:dataTable>
PD: I'm totally sory I post this same question in a ongoing thread I just forgot to clear the subject
Marcus V. Sánchez D.
______________________
Enterprise Developer.
Sun Certified Java Programmer (SCJP)
This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential. If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited. If you received this message in error, please notify the sender immediately.