[jboss-user] [JBoss Seam] - Parameter passing for page action

milli do-not-reply at jboss.com
Thu May 10 04:41:42 EDT 2007


Hi,

How do I pass parameters in the following scenerio?(instead of using session scope)

@Name("home")
  | Class Home
  | {
  | private Category category;
  | 
  | public getCategory()
  | {
  |     if (null == category)
  |           category = CategoryHome.find(id);
  |     return category;
  | }
  | }
home.xhtml:
.....
<h:commandLink action="#{categoryAction.action(home.category)}" value="Action" />

@Name(categoryAction)
  | Class CategoryAction
  | {
  | private Category category;
  | 
  | public Category getCategory()
  | {
  |     return category;
  | }
  | 
  | public String action(Category category)
  | {
  | this.category = category
  | return "category.xhtml"
  | }
  | }category.xhtml:

displays #{categoryAction.category.name} and #{categoryAction.category.description}

If I do as above, the category is always null in category.xhtml. If I set the categoryAction scope to Session it works. I'm trying to find out if there is a better way to do this without using session scope.

If I'm doing something wrong could you please let me know the right way of doing it. Basically I want to be able to pass objects from home page(home component) to category page(categoryAction component) avoiding another DB query.


Any help would be appreciated.

Thanks.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044601#4044601

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044601



More information about the jboss-user mailing list