• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<h:form> with servlet

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic