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

Question on h:outputLink

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please does hutputLink have an attribute that ensures a method is invoked when i click on it. For example in a command Button i can have



This ensures that

method is invoked
 
Krishna Srinivasan
Ranch Hand
Posts: 1862
Firefox Browser Java
 
Yohan Liyanage
Ranch Hand
Posts: 132
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to invoke a Backing Bean method with a link, you can make use of <h:commandLink /> tag. It has an action attribute which allows you to specify the method in EL, just as in a commandButton. Only difference is, this tag will result in a <a /> tag, instead of a button.

I think this is what you are looking for.

HTH.
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yohan Liyanage:
If you want to invoke a Backing Bean method with a link, you can make use of <h:commandLink /> tag. It has an action attribute which allows you to specify the method in EL, just as in a commandButton. Only difference is, this tag will result in a <a /> tag, instead of a button.

I think this is what you are looking for.

HTH.


Thanks for your reply the reason why i am not using <h:commandLink> is that I think the action attributes requires an entry that corresponds to a entry in your faces-config.xml, and it does not allow me to forward say to an external Servlet. The reason i am using outputLink is that it allows me to redirect to an external Servlet whenever a user clicks the page

<hutputLink title="Edit Resume" value="/ccsvscxxd/servlet/ResumeServlet">
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't invoke arbitrary methods in servlets. They're not designed for it. The GenericServlet gets all URL requests sent to its service() method. For HttpServlets, the service() method looks at the request type and dispatches the doGet, doPost, etc. method.
 
Abiodun Adisa
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tim Holloway:
You can't invoke arbitrary methods in servlets. They're not designed for it. The GenericServlet gets all URL requests sent to its service() method. For HttpServlets, the service() method looks at the request type and dispatches the doGet, doPost, etc. method.


I am not invoking methods of servlet themselves, I am invoking the servlet using an outputLink
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic