webtier@glassfish.java.net

Re: [webtier] JSF2.0.2+Spring 3.0 Issue passing parameter to ManagedBean

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Thu, 25 Feb 2010 19:32:48 -0500

On 2/25/10 6:21 PM, webtier_at_javadesktop.org wrote:
> Hi,
>
> I am having issue passing parameters from my dataTable to Managed beans. Here is the snippet
>
> (i is var="i" in datatable and i can see its value)
>
> ------------------------------------------------------
> <h:commandLink id="editUser" value="Edit User" action="#{mybean.getDa(i.usrId)}">
> <f:param name="usrId" value="#{i.usrId}" />
> </h:commandLink>
> or
> <h:commandButton action="#{mybean.getDa()}" value="#{i.usrId}"/>

I understand that this is not the most intuitive thing in the world, but
the "action" attribute is special. It's value is a MethodExpression
that points to a method that takes no arguments and returns an Object
whose toString method will be passed into the navigation system to
decide where to go next.

So, in your case it would be <h:command* action="#{myBean.getDa}" />.

Now, it looks like you're doing Master/Detail or similar here. This
excellent blog entry from my esteemed colleague Jason Lee has what you
need, and more. In fact the challenge may be in extracting just what you
need from the and more.

http://blogs.steeplesoft.com/2009/10/jsf-2-hdatatable-and-ajax-updates/

I hope this helps.

Ed