You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Amit Nair <am...@yahoo.com> on 2006/11/28 18:24:22 UTC

Action method not getting called inside the dataTable

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 :)
-- 
View this message in context: http://www.nabble.com/Action-method-not-getting-called-inside-the-dataTable-tf2719758.html#a7583549
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Action method not getting called inside the dataTable

Posted by Gerald Müllan <bi...@gmail.com>.
Hi,

when using t:saveState scope of the bean will be longer than request
but shorter than session. Exactly what you need when staying on the
same page.

Usage:

<t:saveState value="#{yourBean}"/>

cheers,

Gerald

On 11/29/06, Amit Nair <am...@yahoo.com> wrote:
>
> Hi
>
> Thanks a lot Adrin 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…
>
> Thanks
> Amit
>
>
>
>
> Adrian Mitev-2 wrote:
> >
> > The bean that holds the data mode should be in session scope.
> >
> > 2006/11/28, Amit Nair <am...@yahoo.com>:
> >>
> >>
> >> 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 :)
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Action-method-not-getting-called-inside-the-dataTable-tf2719758.html#a7583549
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Action-method-not-getting-called-inside-the-dataTable-tf2719758.html#a7593593
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Action method not getting called inside the dataTable

Posted by Amit Nair <am...@yahoo.com>.
Hi 

Thanks a lot Adrin 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…

Thanks
Amit




Adrian Mitev-2 wrote:
> 
> The bean that holds the data mode should be in session scope.
> 
> 2006/11/28, Amit Nair <am...@yahoo.com>:
>>
>>
>> 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 :)
>> --
>> View this message in context:
>> http://www.nabble.com/Action-method-not-getting-called-inside-the-dataTable-tf2719758.html#a7583549
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Action-method-not-getting-called-inside-the-dataTable-tf2719758.html#a7593593
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Action method not getting called inside the dataTable

Posted by Adrian Mitev <ad...@googlemail.com>.
The bean that holds the data mode should be in session scope.

2006/11/28, Amit Nair <am...@yahoo.com>:
>
>
> 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 :)
> --
> View this message in context:
> http://www.nabble.com/Action-method-not-getting-called-inside-the-dataTable-tf2719758.html#a7583549
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>