使Glassfish响应Ajax请求JSF 2 [英] Making Glassfish respond to ajax request JSF 2

查看:114
本文介绍了使Glassfish响应Ajax请求JSF 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向服务器(Glassfish v3.1开源版)发出ajax请求,并且出于任何原因,该请求从未发送到服务器,在tomcat 7上运行相同的proyect,它可以正常工作,有任何配置我应该在glassfich或其他任何东西上做?

im使用eclipse helios,jsf 2 MyFaces 2.1.1,richfaces 4.0.0和glassfish 3.1开源版本

这是我的代码

解决方案

Glassfish是完整的Java EE实现,附带了已捆绑的JSF实现(Mojarra). Glassfish会在您的Web应用程序之前自动加载它.但是由于您在Web应用程序中捆绑了一个不同的JSF实现(MyFaces),因此它将发生冲突. Tomcat是一个简单的JSP/Servlet容器,不附带捆绑的JSF,因此也不会发生冲突(直到您将一些具有不同实现/版本的JSP/Servlet库放入您的Webapp中).

您有2个选择:

  1. 摆脱Web应用程序中的MyFaces库.不更改Tomcat的共享类路径以包含JSF库,您的Web应用程序将不再在Tomcat上运行.

  2. 告诉Glassfish不要加载其捆绑的JSF实现,而应使用webapp捆绑的JSF.在您的Web应用程序中编辑/META-INF/sun-web.xml文件以包含以下几行:

     <class-loader delegate="false" />
    <property name="useBundledJsf" value="true" />
     

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>             

解决方案

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" />
    

这篇关于使Glassfish响应Ajax请求JSF 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆