aspose file tools*
The moose likes JSF and the fly likes how to call a servlet from jsf managed bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "how to call a servlet from jsf managed bean?" Watch "how to call a servlet from jsf managed bean?" New topic
Author

how to call a servlet from jsf managed bean?

lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
i need to call a servlet "myServlet" from my managed bean, how do i do it?

thanks.
Lalit Bhatt
Ranch Hand

Joined: Dec 27, 2007
Posts: 69

you can get the ServletContext from FacesContext and than dispatch the request

FacesContext fc = FacesContext.getCurrentInstance();
ServletContext sc = (ServletContext) fc.getExternalContext().getContext();
sc.getRequestDispatcher(url);


Java-JavaEE Hibernate Spring Software Development Business Process Analysis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call a servlet from jsf managed bean?