As far as I know, JSF 2 requires servlet 2.5, so it doesn't run on JBOSS 4.05 (Tomcat 5.5). Unfortunately I have to deploy an application who uses JSF 2.0 and Primefaces on that environment.
Is there any hack to use that?
JSF 2.0 depends heavily on EL 2.1 which is part of Servlet 2.5 and is a major change as opposed to EL 2.0 which is part of Servlet 2.4, but it does not depend on any particular Servlet 2.5 specific API. Servlet 2.4 should work as good. So in theory, you could get JSF 2.0 to work on Servlet 2.4 if you provide your own EL 2.1 API and implementation in /WEB-INF/lib. I did a quick test here on Tomcat 5.5.33 with the following libraries in /WEB-INF/lib:
el-api.jar file copied from lib folder of Tomcat 6.0.x
jboss-el.jar file (implements EL 2.1 and supports EL 2.2 like method invocation with arguments)
jsf-api.jar and jsf-impl.jar from Mojarra 2.0.x
And a Servlet 2.4 web.xml where the JBoss EL is been declared:
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
A simple JSF 2.0 Facelet (not JSP!) with a simple <h:form> with a button with <f:ajax> and a simple #ViewScoped #ManagedBean works for me on Tomcat 5.5.33. Give it a try on your JBoss 4.0.5 and test it thoroughly.
Note that you need a minimum of JDK 1.5, not JDK 1.4. Also note that your application is this way unportable to any Servlet 3.0 container due to presence of the Servlet 2.5 specific el-api.jar file.
Related
I am using WebSphere 8.5 which has a default implementation of JSF 2.0. I would like to use JSF 2.2. I was trying to find out which JAR files should I be getting to have my application use JSF 2.2?
For MyFaces, you'll want myfaces-impl and myfaces-api as well its runtime dependencies commons-beanutils, commons-collections, commons-digester, and commons-logging. For Mojarra, you'll just need jsf-api and jsf-impl.
Whichever implementation you use, make sure to follow the instructions for packaging third-party JSF implementations on WebSphere:
Configuring JavaServer Faces implementation
I would like to upgrade my JSF 1.2 application to JSF 2.2. What's the minimum required Tomcat version for JSF 2.2? I'm currently using Tomcat 5. Is it possible to run JSF 2.2 on it?
JSF 2.2 requires a Servlet 3.0 compatible container, mainly because of the new <h:inputFile> component which requires container-native file upload support. This was only introduced in Servlet 3.0.
If you check the Tomcat versions overview, then you'll see that you need minimally Tomcat 7.x in order to have a Servlet 3.0 compatible container.
So what's the latest version I can update JSF to?
You're not terribly clear on the exact Tomcat version you're currently using (5.0.x vs 5.5.x is quite a difference), but if it is Tomcat 5.5.x, then you could run JSF 2.0/2.1 on it if you supply a custom EL 2.1 compatible implementation along the webapp itself. See also the answer on Running JSF 2.0 on Servlet 2.4 container.
As the questions states, is OmniFaces compatible with JSF 2.2?
Will it have dependencies only on JSF or other Java EE dependencies as well? I.e. will it be able to run just with Tomcat + JSF?
OmniFaces 1.6 showcase application has been tested on GlassFish 4 with Mojarra 2.2.2 and Tomcat 7.0.42 with Mojarra 2.2.3. There were no problems when using OmniFaces 1.6 with Mojarra 2.2.x. Only Glassfish 4 has a problem with using the #{now} and #{startup} beans from OmniFaces, but this is not OmniFaces' fault. For any known issues you can keep track of known issues wiki.
OmniFaces 1.x has no other required dependencies than Servlet, EL and JSF, with the minimum versions 2.5, 2.1 and 2.0 respectively. Tomcat already provides Servlet and EL out the box. You only need to supply JSF yourself (which in turn has a dependency on JSTL 1.2 which is also absent on Tomcat).
How can I check what version of EL is server using .
I am running Websphere 7 . EL classes are in j2ee.jar and manifest is below.
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 2.4 (IBM Corporation)
Specification-Title: Java Platform, Enterprise Edition Specification
Specification-Version: 5.0
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: Java Platform, Enterprise Edition Specification
Implementation-Version: 5.0
Implementation-Vendor: Sun Microsystems, Inc.
Class-Path: activation-impl.jar mail-impl.jar
EL version goes hand in hand with Servlet/JSP version which is dependent on the servletcontainer implementation/version used and also on the web.xml root declaration of your webapp.
Servlet 5.0 comes with JSP 3.0 and EL 4.0 (Jakarta EE 9).
Servlet 4.0 comes with JSP 2.3 and EL 3.0 (Java EE 8).
Servlet 3.1 comes with JSP 2.3 and EL 3.0 (Java EE 7).
Servlet 3.0 comes with JSP 2.2 and EL 2.2 (Java EE 6).
Servlet 2.5 comes with JSP 2.1 and EL 2.1 (Java EE 5).
Servlet 2.4 comes with JSP 2.0 and EL 2.0 (J2EE 1.4).
Servlet 2.3 comes with JSP 1.2 without EL (J2EE 1.3). EL is to be provided by JSTL 1.0 and works inside JSTL tags only.
WebSphere 7 is a Java EE 5 certified container which thus implies Servlet 2.5 which in turn thus comes with JSP/EL 2.1. However, if the web.xml of your webapp is declared conform for example Servlet 2.4, then your webapp will run in Servlet 2.4 modus with JSP/EL 2.0.
Since you tagged this JSF, I guess that the sole purpose of this question is to figure out if you could use the new EL 2.2 feature of being able to invoke non-getter methods with arguments in EL. That's thus not natively supported by your container. However, you could install JBoss EL as per this answer to get it to work on Servlet 2.5 containers.
See also:
Difference between JSP EL, JSF EL and Unified EL
I am using jboss 4.0 and Java 1.5. I want to use JSF, but I know that this version is fit to JSF 1.1 version. Is it possible to use the latest JSF version on JBoss 4.0?
As JSF API is built on top of JSP/Servlet API, the maximum supported JSF version depends on the maximum supported JSP/Servlet version.
JSF 1.0 and 1.1 requires a minimum of Servlet 2.4 / JSP 2.0.
JSF 1.2 works on Servlet 2.4, but requires a minimum of JSP/EL 2.1 which goes hand in hand with Servlet 2.5, so it requires after all Servlet 2.5. If you replace JSP 2.1 by Facelets 1.x as default view technology, then you can use JSF 1.2 on Servlet 2.4.
JSF 2.0 which uses by default Facelets 2.x requires a minimum of EL 2.1 which goes hand in hand with Servlet 2.5, so it requires after all Servlet 2.5. If you supply your own EL 2.1 API/impl, then you can in theory run JSF 2.0 on Servlet 2.4.
JSF 2.1 requires a minimum of Servlet 3.0 and Java 1.6 (6.0).
JBoss 4.x is a Servlet 2.4 container. So if you stick to JSP, then you can at highest use JSF 1.1. But if you replace JSP by Facelets 1.x, then you can use JSF 1.2. JSF 1.2 offers as the most important advantages the possibility to get rid of <f:verbatim>, to use <f:setPropertyActionListener>, to use #PostConstruct, etc.
JSF 2.0 is in theory possible, but I don't guarantee that it will work 100% as I am not fully aware of any possible side effects. I have as far only run it successfully with a very basic test page with an ajax form and a view scoped bean on Tomcat 5.5. It might fail when it goes into the complex. See also Running JSF 2.0 on Servlet 2.4 container.