• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<h:form> with servlet

 
alexandre monassa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to know if is possible to get the parameters from a jsf form (h:form) through servlets. For example :
<h:form>
<h:inputText id="name"/>
<h:commandButton action="submit">
</h:form>

I want to get through Servlets rather than managedbeans.

doGet(HttpservletResponse response, HttpservletRequest request) throws exception {

String name = request.getParameter("name");

}


Nothing appear in the getParameter results , only appears when I use HTML form and input .
 
Tim Holloway
Saloon Keeper
Posts: 18302
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Alexandre!

No, it is not possible. JSF tags are processed by the FacesServlet. In order for any other servlet to replace the FacesServlet, that servlet would also have to replicate the JSF internal functionality provided by the FacesServlet.

You can - and I not infrequently do - put a stock HTML FORM on a JSF page that posts to a stock servlet or JSP, but of course, it acts just like any other HTML form. Meaning no JSF-supplied validation, no auto-population of backing bean variables, no auto-initialization of form control values, and so forth.

JSF provides managed beans instead of servlets because most HTML forms processing follows certain basic rules. Instead of making you replicate those processes on a page-by-page basis, JSF provided a Model/View/Controller framework where the FacesServlet and tag functions supply the Controller functionality so that you can define the View in an abstract View Template Language and your UI Model objects can be implemented in POJO code rather than having to code specifically for a given environment (such as the web) or framework (such as Struts).

The whole point of JSF, in fact, is to minimize work and reduce maintenance costs without requiring complexity or arcane code.
 
alexandre monassa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks @Tim Holloway, I 'm kind of gracefully. I did a html form and put some jsf fields like inputtext, and the servlet request var didn't get the jsf ones , it just get the html ones. So I had tried to do this until now , but After your answer I won´t try again. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic