Here are some code snippets on how to pass parameters. Definitely will come in handy for anybody who experiments in this area.
If you want to set some variables or do some actions when user clicks on a commandlink here is how you do it: I am passing the transition name and i am setting the transitionName variable in my taskBean
<h:commandLink id="transition#{rid}" style="display:none; visibility: hidden;" action="#{taskBean.action}">
<f:setPropertyActionListener target="#{taskBean.transitionName}" value="#{transition.name}" />
</h:commandLink>
Based on the transition, I want to be able to set the url for navigation..so if the transition name is for example, reject I need to go to the next screen where you can enter the reject reason..or else I go myportal.jsf in my case. You do all this when the action event taskBean.action is called when the commandlink is clicked.
<n:nav outcome="success" url= "#{taskBean.url}" storeMessages="true"/>
I found this excellent article with different ways to pass parameters. It almost covers every single way of accessing and passing variables.
http://balusc.blogspot.com/2006/06/communication-in-jsf.html
Here is another basic example:
http://kalanir.blogspot.com/2006/11/parameter-passing-in-jsf_5752.html
No comments:
Post a Comment
Please feel free to post your comments!