• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF Servlet

 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I want to start using JSF primefaces, im using NEtbeans 7.0+,
to use a FacesServlet in Netbeans is a normal Servlet? or where i should opne a JSF Servlet?

If I go to Java Server Faces folder to add a new File Type i have the following:
JSF Page
JSF Managed Bean
JSF Faces Configuration
...
...
but i dont see any JSF Servlet.

Should I open from JSP a normal Servlet?

Sorry for this silly question.

Thanks in advance.
-M
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSF is a Model/View/Controller architecture and yes, there is a very definite reason why you must use the FacesServet - it's the master Controller for the JSF MVC system.

Technically, you could also use a subclass of FacesServlet, but in all the years I've worked with JSF I've never seen a need to do so. The stock FacesServlet works well enough.

JSF does not "own" the webapp. That makes it convenient, because you can migrate to JSF gradually and even run frameworks such as Struts side by side with JSF in the same webapp. However, any web pages defined in JSF View Definition Language (xhtml) and that you want to get JSF's benefits from (model/view automated data transfer, input validation and error reporting, action methods and such) must be handled via the FacesServlet.

There are really only 2 things you can do with the FacesServlet itself.

1. Code a URL pattern(s) so that JSF URK requests will be properly routed via the FacesServlet.

2. Set FacesServlet operating parameters such as the one that determines whether the user's state will be held on the server or passed back and forth in client requests.

Both of the above are defined in the web.xml and are basically "set-and-forget" items that you will almost never change.
 
Mauro Trevigno
Ranch Hand
Posts: 99
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim.

:)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!