While upgrading application to Jsf2.0 created in Spring3 and Jsf1.0 (myfaces), i am facing some issues mentioned below.
I have done following steps to upgrade the application.
From IntelliJ IDEA:
* Open project settings/Monitor/Dependencies
* Removed facelet*jar, el*.jars, myfaces* jars from project
* Added jsf2.0.x ri mojarra jars and tomahawk1.1.9.jar
* Open project settings/monitor/web settings
* Under "modules and libs to package": remove el-.jars,facelet-jar and myfaces jars
* Added jsf2.0.x ri mojarra jars and tomahawk1.1.9.jar
* Removed erroneous class usages from our classes Lists.java and RegExValidator.java. In Lists.java, replace import with org.apache.commons.lang.LocaleUtils. In RegExValidator, replace import with "org.apache.myfaces.shared_tomahawk.util.MessageUtils".
Edit Web.xml:
* facelets.VIEW_MAPPINGS -> javax.faces.FACELETS_VIEW_MAPPINGS
* facelets.LIBRARIES -> javax.faces.FACELETS_LIBRARIES
* Change Faces Servlet to <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
* Change header to:
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Edit faces-config.xml:
* Add header:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
* Remove line "<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>"
After doing all the steps mentioned above getting the following error:
A literal value was specified for attribute actionListener that is defined as a deferred m开发者_高级运维ethod with a return type of void. JSP.2.3.4 does not permit literal values in this case
Actually Jsf2.0 el expressions #{myBean.property} are not getting resolved thats why its showing the above error.
Can anybody guide me, what is missing, so that i can successfully migrate application to Jsf2.0
Thanks in Advance, Dhillon
A literal value was specified for attribute actionListener that is defined as a deferred method with a return type of void. JSP.2.3.4 does not permit literal values in this case
This EL validation error means that you've somewhere a
<h:commandButton actionListener="somestring" />
instead of
<h:commandButton actionListener="#{someBean.actionListener}" />
or
<h:commandButton action="somestring" />
(instead of h:commandButton
you can also read any UICommand
component like h:commandLink
)
Just locate/lookup the culprit in the code and fix it accordingly.
Upgrade web-app version="3.0"
to latest. Previously web-app version is 2.5 at that time I got error, after upgrade to 3.0 issue resolved.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
精彩评论