简体   繁体   English

关于JBoss 6和EL表达式的JSF 1.2没有得到解决

[英]JSF 1.2 on JBoss 6 and EL expression not being resolved

I have been hitting my head against the wall with this one for few hours already and I dont have a clue why this is happening... 我已经用这个用了几个小时撞到我的头上,我不知道为什么会发生这种情况......

Recently we have began process of moving from JBoss 4.2.3 to JBoss 6 Final. 最近我们开始从JBoss 4.2.3转到JBoss 6 Final。 We are using JSF 1.2. 我们正在使用JSF 1.2。 I have sucessfully adapted application to new JBoss (mostly by removing some JARs from WEB-INF/lib and tunning web.xml a bit) and app starts nicely. 我已经成功地将应用程序改编为新JBoss(主要是通过从WEB-INF / lib中删除一些JAR并稍微调整web.xml)并且应用程序启动很好。

The problem is that some EL expressions are not being resolved, while others do. 问题是某些EL表达式没有得到解决,而其他表达式则没有得到解决。 I also get 0 exceptions or warnings in the logs. 我还在日志中得到0个异常或警告。

I have a bean called "mapContext" which is defined in one of the JSF xml config files. 我有一个名为“mapContext”的bean,它在一个JSF xml配置文件中定义。 It is being created just fine. 它被创造得很好。 On my JSF page I have: 在我的JSF页面上,我有:

<h:inputHidden id="mapContextId" value="#{mapContext.webContextId}" />   

and in the rendered page it becomes: 在呈现的页面中它变成:

<input id="mapForm:mapContextId" type="hidden" name="mapForm:mapContextId" value="#{mapContext.webContextId}" />

As you can see, JSF tag is rendered just fine, but EL is not interpreted. 正如您所看到的,JSF标记渲染得很好,但不解释EL。

There are no logs in the server.log indicating any problems. server.log中没有记录任何问题的日志。

JSF 1.2, JSTL 1.2, Jboss 6, JDK 6. JSF 1.2,JSTL 1.2,Jboss 6,JDK 6。

Web.xml: web.xml中:

    <context-param>
    <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
    <param-value>Mojarra-1.2</param-value>
</context-param>

Any help would be greatly appreciated! 任何帮助将不胜感激!


More details: 更多细节:

Well I have doublechecked my code and configuration. 好吧,我已经仔细检查了我的代码和配置。 Also I have added some logging to the Custom Variable Resolver I am using, to see what beans are used by JSF. 此外,我已经添加了一些日志记录到我正在使用的自定义变量解析器,以查看JSF使用的bean。 Results are weird. 结果很奇怪。

First of all I have enhanced my JSF page with different outputs, and it now looks like this: 首先,我使用不同的输出增强了我的JSF页面,它现在看起来像这样:

    <h:inputHidden id="mapContextId1" value="#{mapContext}" />
<h:inputHidden id="mapContextId2" value="#{selectionPointSymbol.width}" />    
<h:inputHidden id="mapContextId" value="#{mapContext.webContextId}" />    
<h:inputHidden id="mapContextId3" value="#{selectionPointSymbol4.width}" />

and is rendered as: 并呈现为:

<input type="hidden" name="mapForm" value="mapForm" />
<input id="mapForm:mapContextId1" type="hidden" name="mapForm:mapContextId1" value="#{mapContext}" />
<input id="mapForm:mapContextId2" type="hidden" name="mapForm:mapContextId2" value="#{selectionPointSymbol.width}" />
<input id="mapForm:mapContextId" type="hidden" name="mapForm:mapContextId" value="#{mapContext.webContextId}" />
<input id="mapForm:mapContextId3" type="hidden" name="mapForm:mapContextId3" value="#{selectionPointSymbol4.width}" />

I checked the logs and I can see that mapContext is being resolved just fine by non-standard JSF tags: 我检查了日志,我可以看到mapContext正在被非标准的JSF标签解决得很好:

12:27:24,911 ERROR [mb.ags.adf.resolvers.AGSUserResolver] AGSUserResolver asked to resolve: mapContext
12:27:24,911 ERROR [mb.ags.adf.resolvers.AGSUserResolver] AGSUserResolver delegated to: com.sun.faces.el.ChainAwareVariableResolver@ab4f3c and resulted with: mb.ags.adf.map.MbWebContext@20
12:27:24,927 ERROR [mb.ags.adf.resolvers.AGSUserResolver] AGSUserResolver asked to resolve: mapContext
12:27:24,927 ERROR [mb.ags.adf.resolvers.AGSUserResolver] AGSUserResolver delegated to: com.sun.faces.el.ChainAwareVariableResolver@ab4f3c and resulted with: mb.ags.adf.map.MbWebContext@20

(lots of them in the logs). (很多都在日志中)。

But there is no single log about: selectionPointSymbol or selectionPointSymbol4 (no such bean defined at all!), which are only used in standard tags. 但是没有单一的日志:selectionPointSymbol或selectionPointSymbol4(根本没有定义这样的bean!),它们仅用于标准标签。

Still no errors or warnings in the server log :( 服务器日志中仍然没有错误或警告:(


More details: simple test. 更多细节:简单测试。

JSF page: JSF页面:

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page buffer="96kb" autoFlush="true" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<f:view>
<f:loadBundle basename="mb.ags.res.AGSClient" var="msg"/>
<html>
<head>
<title>*********</title>
<link rel="stylesheet" title="base" href="/gis/css/base-style.css" type="text/css" media="screen" />
<style type="text/css">
  body { overflow:auto; }
</style>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>

<div id="loading_table_container" style="position:absolute; text-align:center; left:0; top:0; width:100%; height:100%; z-index:20000; background-color:white;">
    <table id="loading" style="z-index:20001;" height="100%" width="100%">
        <tr>
            <td align="center" valign="middle" style="font-size: 12px">
                <img src="/gis/images/loading_big.gif" alt="Loading..." align="absmiddle"/><br/><br/>
                <h:outputText value="#{msg.welcome_page_map_client_loading}"/>
                <h:outputText id="mapContextId2" value="#{selectionPointSymbol.width}" />
            </td>
        </tr>
    </table>
</div>        

<script>
    var url = "<%= redirectUrl %>";
    var refresh = "<meta http-equiv=\"refresh\" content=\"1000; URL=" + url + "\" />";
    document.writeln(refresh);
</script>
</body>
</html>
</f:view>

is rendered as: 呈现为:

<html>
  <head>
    <title>GIS</title>

    <link rel="stylesheet" title="base" href="/gis/css/base-style.css" type="text/css" media="screen" />
    <style type="text/css">
      body { overflow:auto; }
    </style>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <script type="text/javascript" language="javascript" src="/gis/js/prototype.js"></script>  
    <script type="text/javascript" language="javascript" src="/gis/js/scriptaculous/scriptaculous.js?load=effects"></script>
    <script type="text/javascript" language="javascript" src="/gis/js/ext/ext-prototype-adapter.js"></script>
    <script type="text/javascript" language="javascript" src="/gis/js/ext/ext-all.js"></script>

    <script type="text/javascript" language="javascript" src="/gis/js/mb_errors.js"></script>
    <script type="text/javascript" language="Javascript" src="/gis/js/esri_core.js"></script>
    <script type="text/javascript" language="Javascript" src="/gis/js/mapviewer.js"></script>
    <script type="text/javascript" language="javascript" src="/gis/js/ExternalClient.js"></script>
    <script type="text/javascript" language="Javascript" src="/gis/js/index_init.js"></script>
  </head>

  <body>

    <div id="loading_table_container" style="position:absolute; text-align:center; left:0; top:0; width:100%; height:100%; z-index:20000; background-color:white;">
        <table id="loading" style="z-index:20001;" height="100%" width="100%">
            <tr>
                <td align="center" valign="middle" style="font-size: 12px">
                    <img src="/gis/images/loading_big.gif" alt="Loading..." align="absmiddle"/><br/><br/>
                    #{msg.welcome_page_map_client_loading}<span id="mapContextId2">#{selectionPointSymbol.width}</span>


                </td>
            </tr>
        </table>
    </div>        

    <script>
        var url = "/gis/mapviewer.jsf?msid=1000005&uid=1&cid=1&mapContextId=1";
        var refresh = "<meta http-equiv=\"refresh\" content=\"1000; URL=" + url + "\" />";
        document.writeln(refresh);
    </script>
  </body>
</html>

Still no clue what is happening, as there are no logs indicating any problems. 仍然不知道发生了什么,因为没有日志表明存在任何问题。

Ensure of the following things: 确保以下事项:

  • You do not have servletcontainer-specific libraries like el-*.jar in /WEB-INF/lib . /WEB-INF/lib没有类似servletcontainer的库,如el-*.jar
  • The web.xml is declared conform Servlet 3.0 specification (as JBoss 6 supports). web.xml声明符合Servlet 3.0规范(如JBoss 6支持)。
  • The web.xml does not contain a context param of com.sun.faces.expressionFactory which points to a different (and apparently non-existing) EL implementation. web.xml不包含com.sun.faces.expressionFactory的上下文参数,该参数指向不同的(显然不存在的)EL实现。

JSF silently returns the blank string if mapContext is not defined in your EL snippet. 如果未在EL片段中定义mapContext则JSF将静默返回空字符串。

Are you absolutely certain that mapContext is properly configured? 您是否确定mapContext已正确配置? It is very easy to miss in a migration process. 在迁移过程中很容易错过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM