Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to render a link based on some condition

 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like bit easy task. but im not able to solve this.

im calling a web application from another web application and i pass userid along with this. i.e



the above link should provide list of links based on the user category. i.e i need something like below: but the second link should be rendered based on a condition.

Apply Leave - this link loads a form to apply leave
Approve / Reject Leave. - this link provides a manager view, so a manager can approve or reject the leave.

I looked into outputLink, commandLink; but im not clear which one to use.

Please help.

Thanks for your time.
 
Cesar Loachamin
Ranch Hand
Posts: 90
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dhamayanthi

You must use a <h: outputLink> because you want to go to another web application, this outputLink is rendered like a common <a> html tag, If you use a <h:commandLink> you produce a Navigation that is handle by the NavigationHandler and produce that a navigation case be searched for the outcome provided in the action attribute of the commandLink, If you need to show the link based in a condition you can use a rendered attribute, for example:

Hope this helps you with your problem, If not let me know.
Regards
Cesar
 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for clarifying the usage of the commandLink and outputLink. It really helped me to solve my problem.

Thanks Again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!