aspose file tools*
The moose likes JSF and the fly likes Question on h:outputLink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Question on h:outputLink" Watch "Question on h:outputLink" New topic
Author

Question on h:outputLink

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
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

Joined: Jul 28, 2003
Posts: 1844

http://www.horstmann.com/corejsf/jsf-tags.html#Table4_18


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Yohan Liyanage
Ranch Hand

Joined: Aug 17, 2007
Posts: 132

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.


Yohan Liyanage
http://blog.yohanliyanage.com
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
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

Joined: Jun 25, 2001
Posts: 16014
    
  20

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
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
 
wood burning stoves
 
subject: Question on h:outputLink