java - JSF and Libraries Unclarity -


after time spent servlets , jsps i'm trying learn jsf. i've learned basics, made couple of simple examples, have basic ideea of 'workflow' still can't understand what's javax.faces.webapp.facesservlet thing.

<servlet>   <servlet-name>faces servlet</servlet-name>   <servlet-class>javax.faces.webapp.facesservlet</servlet-class>   <load-on-startup>1</load-on-startup>   </servlet> <servlet-mapping>   <servlet-name>faces servlet</servlet-name>   <url-pattern>*.jsf</url-pattern>   </servlet-mapping> 

i know "faces servlet" it's 'internal' name xml , gets bind class, in case: javax.faces.webapp.facesservlet. class anyway?! i'm using eclipse, created new dynamic project, glassfish 4.0 server, jsf 2.0 configuration (selected no library) , neither did import jar. how can working? , when try run same thing jboss must import javax.faces-2.2.2.jar file.

ok, library might included in glassfish since works but... face problems if try deploy app on server? jboss or websphere.

in nutshell: prerequisites when working jsf technology :)

thank you.

javax.faces.webapp.facesservlet class implements servlet interface. in order recognized in application, should add in web.xml <servlet>. done in configuration:

<servlet>     <servlet-name>faces servlet</servlet-name>     <servlet-class>javax.faces.webapp.facesservlet</servlet-class>     <load-on-startup>1</load-on-startup> </servlet> 

now, can refer class in web.xml file using faces servlet name. next thing define url handled servlet. done in configuration:

<servlet-mapping>     <servlet-name>faces servlet</servlet-name>     <url-pattern>*.jsf</url-pattern> </servlet-mapping> 

so, or post request application server ends jsf suffix handled faces servlet. can use other url patterns servlet mapping. better explained here: jsf facelets: see url .jsf , .xhtml. why?

will face problems if try deploy app on server? jboss or websphere?

if application server java ee 5 compliant server, have access servlet using mojarra implementation in form of jsf 1.2. java ee 6 compliant servers in mojarra implementation in of jsf 2.x (check notes of application server know exact version). currently, glassfish 4, mojarra jsf 2.2.

in case application server not java ee compliant server e.g. tomcat, must add libraries manually in web-inf/lib folder of web application. libraries add? depending on jsf version , requirements (read further).

what prerequisites when working jsf technology?

this covered in stackoverflow jsf wiki. taken there:

minimum requirements

  • jsf 1.0 , 1.1 requires minimum of servlet 2.4 / jsp 2.0 , java 1.4.
  • jsf 1.2 works on servlet 2.4, requires minimum of jsp/el 2.1 goes hand in hand servlet 2.5, after requires servlet 2.5. if replace jsp 2.1 facelets 1.x default view technology, can use jsf 1.2 on servlet 2.4. requires minimum of java 1.5.
  • jsf 2.0 uses default facelets 2.x requires minimum of el 2.1 goes hand in hand servlet 2.5, requires after servlet 2.5. if supply own el 2.1 api/impl, can in theory run jsf 2.0 on servlet 2.4. requires minimum of java 1.5.
  • jsf 2.1 uses servlet 3.0 specific features, backwards compatible servlet 2.5. servlet 3.0 features optional.
  • jsf 2.2 requires minimum of servlet 3.0, because of new file upload component internally using standard servlet 3.0 api without need 3rd party libraries. requires minimum of java 1.6.

examples of servlet 2.4 containers tomcat 5.5.x, jboss 4.x , sun java application server.

examples of servlet 2.5 containers tomcat 6.0.x, jboss 5.x , glassfish 2.x.

examples of servlet 3.0 containers tomcat 7.0.x, jboss 6.x , 7.x , glassfish 3.x.

examples of servlet 3.1 containers tomcat 8.0.x, wildfly 8.x, , glassfish 4.x.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -