f:param to transmit a parameter in a commandLink?

Nargzul
Nargzul used Ask the Experts™
on
Hi every body!

I've a problem, It must be a simple thing but I don't know what.

I've a rich:table that display me some information, and I want to have a link on every row pointing to a page displaying information about the user.

I tought I've found a solution, but I encounter a little problem.

When I have my code without the f:param, I'm redirect to the page, displaying a static text. but I add my parameter, It doesn't work anymore: it's add a # at the url of my page and doesn't move.

Must we do something special in facelet config file?
//the code that moves to another page:
                     <rich:column sortBy="#{deal.idUser.username}" filterBy="#{deal.idUser.username}" filterEvent="onkeyup">
                            <f:facet name="header">
                                <h:outputText value="Username" />
                            </f:facet>
                            <h:commandLink action="viewInfoPerson">
                                <h:outputText value ="#{deal.idUser.username}"/>
                            </h:commandLink>
                        </rich:column>
 
 
//The code that doesn't work anymore
                     <rich:column sortBy="#{deal.idUser.username}" filterBy="#{deal.idUser.username}" filterEvent="onkeyup">
                            <f:facet name="header">
                                <h:outputText value="Username" />
                            </f:facet>
                            <h:commandLink action="viewInfoPerson">
                                <h:outputText value ="#{deal.idUser.username}"/>
                                <f:param name="idUsr" value="#{deal.idUser.stringId}"/>
                            </h:commandLink>
                        </rich:column>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Refer to this question where the author is able to pass param with commandlink

http://www.experts-exchange.com/Programming/Languages/Java/J2EE/Frameworks/JSF/Q__24590879.html

Author

Commented:
What is this "tr" tag? I dont know it
Narg
The tr tag is for using command button.
Look at the sample code given in the question
<h:commandLink action="#{MyBackingBean.removeHandler}" type="submit" value="Remove" title="RemoveHandler">
        <f:param name="f1" value="#{jsplist.field1}"/>
        <f:param name="f2" value="#{jsplist.field2}"/>
        <f:param name="f3" value="#{jsplist.field3}"/>
</h:commandLink>

Open in new window

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Author

Commented:
yeah and they said this didnt work
Nargzul
Please understand the point.
The author was able to make it work with commandlink but he wants to make iit by commandbutton.

for you,you wanted to use COMMANDLINK and hence that example which as per the post says is working

Author

Commented:
Okay, so say me what's going wrong??

When I click on the link, I only get a "#" at the end of my current page.

The rule exist in my face config, the next page too
<h:form>
   <h:commandLink action="exinfos" type="Submit" value="Get more infos">
     <f:param name="idExchange" value="#{exchange.idString}"/>
   </h:commandLink>
</h:form>

Open in new window

Commented:
Hey,

You need to add <Redirect/> tag in your navigation tags. I have given an example below. It should work for you now.

<navigation-rule>
  <navigation-case>
   <from-outcome>exinfos</from-outcome>
   <to-view-id>/faces/destinationFile.jsp</to-view-id>
   <redirect/>
  </navigation-case>
 </navigation-rule>
Commented:
I've this rule in my xml config files.

It's strange because I've no problem with other redirection that calls a function to know the navigation case to use.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial