This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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 Spring Roo Web Applications
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to call a servlet from jsf managed bean?
 
Similar Threads
JSF Url Mapping (Newbie)
Accessing JSF sesson bean from a servlet
How to call servlet from JSF ?
Calling a Managed Bean method from Servlet
how to trigger a servlet from JSF