问题
I'm trying to do an ajax request to my server (Glassfish v3.1 open source edition) and for any reason the request never go to the server, running the same proyect on tomcat 7 it works correctly, there's any configuration that i should make on glassfich or anything??
im using eclipse helios, jsf 2 MyFaces 2.1.1, richfaces 4.0.0, and glassfish 3.1 open source edition
here's my code
<h:panelGroup>
<h:inputText id="firstName"
value="#{RegistrationForm.first_name}"
required="true"
requiredMessage="Please enter your first name">
<f:converter converterId="bankingCore.UpperCaseConventer for="firstName"/>
<f:ajax event="blur" execute="@all" render="@form"/>
</h:inputText>
<h:message id="NameError" for="firstName" styleClass="errorClass"/>
</h:panelGroup>
回答1:
Glassfish as being a full Java EE implementation ships with a JSF implementation (Mojarra) already bundled. Glassfish will auto-load it before your webapp. But since you bundled a different JSF implementation (MyFaces) in your webapp, it will collide. Tomcat is a simple JSP/Servlet container and does not ship with JSF bundled so there's also nothing which will collide (until you drop some JSP/Servlet libraries of a different implementation/version in your webapp).
You have 2 options:
Get rid of MyFaces libraries in your webapp. Your webapp will only not run on Tomcat anymore without changing Tomcat's shared classpath to include JSF libraries.
Tell Glassfish to not load its bundled JSF implementation but to use the webapp-bundled JSF instead. Edit the
/META-INF/sun-web.xml
file in your webapp to contain the following lines:<class-loader delegate="false" /> <property name="useBundledJsf" value="true" />
来源:https://stackoverflow.com/questions/6823719/making-glassfish-respond-to-ajax-request-jsf-2