当javax.faces.PROJECT_STAGE为Production时,未定义mojarra [英] mojarra is not defined when javax.faces.PROJECT_STAGE is Production

查看:80
本文介绍了当javax.faces.PROJECT_STAGE为Production时,未定义mojarra的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我得到了一个例外,未定义mojarra".

Today I got the exception "mojarra is not defined".

我偶然发现了以下问题:

I stumbled in the following questions: This, this and this.

这些解决方案都不是我的问题.

Neither of those solver my issue.

经过一些调试后,我通过从以下位置更改web.xml中的javax.faces.PROJECT_STAGE参数来解决此问题:

After some debugging I fixed the issue by changing javax.faces.PROJECT_STAGE param in web.xml from:

<param-value>Production</param-value>

收件人:

<param-value>Development</param-value>

它解决了此问题,但是将项目投入生产时应该怎么做?我应该把发展的范式留在世界上吗?

It fixed the issue, but what should I do when putting my project in production? Should I leave the param on development?

推荐答案

这几天我遇到了同样的麻烦,我发现这是我的扩展无所不在的资源处理程序造成的.

i ran into same trouble these days and i figured out, that it was caused by my extendend omnifaces resourcehandler.

public class VersionableResourceHandler extends DefaultResourceHandler {
  //...
  @Override
  public Resource decorateResource(Resource resource) {
    if (resource == null) {
        return resource;
    }
    return new RemappedResource(resource, resource.getRequestPath() + "?v=1_2_1");
  }
}

使用

<param-value>Development</param-value>

带有我附加的版本字符串的生成的输出将是:

the generated output with my appended version-string will be:

 <script type="text/javascript" src="/javax.faces.resource/jsf.js?ln=javax.faces&amp;stage=Development%3Fv=1_2_1"/>

<param-value>Production</param-value>

生成的输出如下:

<script type="text/javascript" src="/javax.faces.resource/jsf.js?ln=javax.faces%3Fv=1_2_1"/>

由于第二个?"而无效,因此必须将?v = 1_2_1"替换为& v = 1_2_1".

which is invalid because of the second "?", so "?v=1_2_1" had to be replaced by "&v=1_2_1".

这篇关于当javax.faces.PROJECT_STAGE为Production时,未定义mojarra的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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