| Author |
how we forward a JSF page into Servlet
|
Vimal Bharathi Andiappan
Greenhorn
Joined: Jun 12, 2008
Posts: 7
|
|
|
Hi i am new to JSF , I have a problem how to forward a JSF page into Sevlet. Same thing i will be used in jsp means it is very easy through (form action="") but in JSF there is no "form action ". Any body knows please reply
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
A JSF page can link to any kind of target, including servlets. However a JSF FORM is expected to talk to JSF. That's because you're getting fields populated from JSF and JSF manages a cycle of repeated validations and error displays until the user either gets the data clean enough to use of abandons the page. JSF also carries a lot of freight that other platforms don't want/need/understand. In order to submit a form to a servlet, it has to be a non-JSF form, so you usually are going to find life simpler if the form page is completely non-JSF - a straight JSP, servlet-generated HTML, Struts, or whatever. Since you normally pre-load data into a form, this usually means that the JSF action processor that takes you there is going to have to do a forwarding operation to invoke the form setup code.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Jerwin Louise Uy
Ranch Hand
Joined: Oct 27, 2007
Posts: 75
|
|
Client Side - You can embed the resource (with can either be a servlet or a resource), but you have the pass the parameters in the traditional way. Server Side - You can either perform a redirect or a dispatch ## redirect FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext ec = facesContext.getExternalContext(); ec.redirect(url) ## dispatch FacesContext facesContext = FacesContext.getCurrentInstance(); ExternalContext ec = facesContext.getExternalContext(); ec.dispatch(url) In essence, ExternalContext object serves as your window to non jsf resources. I hope this helps.
|
Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
email: jerwin.uy@incuventure.net
|
 |
Mahendra Pratap
Ranch Hand
Joined: Feb 25, 2008
Posts: 42
|
|
can some body please tell me what to put in url. the actual URL or just the path of class file specifiled in servlet mapping in web.xml
thanks a lot
|
Mahendra
http://randomtechieblog.blogspot.com
|
 |
 |
|
|
subject: how we forward a JSF page into Servlet
|
|
|