File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Question on h:outputLink Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply 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: 493
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: 1790
http://www.horstmann.com/corejsf/jsf-tags.html#Table4_18


Krishna Srinivasan
Java Writers Needed
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: 493
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: 12513

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.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 493
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
 
 
subject: Question on h:outputLink
 
Threads others viewed
JSF with EL notation throwing ReferenceSyntaxException PLEASE HELP
How to do URLEncoding with HtmlOutputLink
having navigation probelms using h:commandLink
JSF + Portlet URL encoding
cc:insertChildren only works once
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture