views:

16

answers:

1

I'm trying to pass a <f:param name="id" value="{someValue.id}" /> and retrieve it in the next page (so I can put it in an output link). This is what I tried:

<h:outputLink value="#{linkController.clientEdit}?id={id}">#{linkController.clientEdit}?id={id}</h:outputLink>

The problem is, the part that is between the tag prints what I want, i.e.: /my/path?id=1, but the output link's value is /my/path?id={id}. Is it possible to put that id value in the outputLink's value attribute?

@Edit: the whole application is a bit weird: we have a dataTable with some records, the last column hold an image which if you click sets the current row in a bean (which is keppAlive), sets the id param and shows a contextMenu (RichFaces) which has to menuItems: edit and delete. When I hit edit I want to be redirected to the edit page with the id param. The problem is the menuItem has only an action attribute which takes a String where to go, but when it goes there it doesn't change the URL in the browser. That's why I wanted to put the outputLink in the menuItem and drop the action attribute...

A: 

You forgot the # EL prefix.

<f:param name="id" value="#{someValue.id}" />

Then, to access it in subsequent request, use #{param.name}. So:

#{linkController.clientEdit}?id=#{param.id}

The #{param} refers to a Map<String, String> with all request parameter name-value pairs.

BalusC
actually I tried doing that but the result was something like "/my/path?id=" so it didn't even put anything where #{param.id} was.
Zenzen
Either the way how you passed it is wrong, or there was a redirect involved.
BalusC
I edited my original post with how the flow of the website works.
Zenzen
It's still unclear how you're passing it. Using a `h:commandLink`? Let's ask the other way: where did you put `f:param` in?
BalusC