Making Glassfish respond to ajax request JSF 2

百般思念 提交于 2019-12-30 11:30:30

问题


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:

  1. 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.

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!