JSF面向WEB-INF外的配置文件? [英] JSF faces config file outside WEB-INF?

查看:192
本文介绍了JSF面向WEB-INF外的配置文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建多个面配置文件时,在WEB-INF之外使用faces-config.xml是正确的吗? JSF规范似乎对此并不十分清楚(第10.1.3节)

When creating multiple faces config files, it is correct to have the faces-config.xml outside of WEB-INF? The JSF spec does not seem to be very clear about this (Section 10.1.3)

如果是,那么应该如何在web.xml中声明这个faces-config.xml ? IDE生成的路径(如Eclipse / JDev)通常使用类似的东西:

If yes, how should this faces-config.xml be declared in web.xml? the paths generated by IDE's (like Eclipse/JDev) generally use something like:

<context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config1.xml</param-value>
</context-param>

现在,如果我的faces-config.xml在WEB-INF之外 - 声明是否正确param值如/WebContent/WEB-INF/faces-config2.xml?

Now, if my faces-config.xml is outside WEB-INF -- is it correct to declare the param-value as something like "/WebContent/WEB-INF/faces-config2.xml"?

推荐答案

这是可能的,但不推荐。你在WEB-INF下放置配置文件的原因是服务器知道不提供这些文件 - 你有代码,数据库配置和其他敏感的东西。

It is possible, but not recommended. The reason you put configuration files under WEB-INF is that the server knows not to serve these files - you have your code, database configuration and other sensitive stuff there.

你不能使用/WebContent/WEB-INF/faces-config2.xml - AFAIKWebContent是eclipse特有的。将配置文件名称设置为WAR内的绝对名称。这意味着它们将始终以/ WEB-INF /\".

You cannot use "/WebContent/WEB-INF/faces-config2.xml" - AFAIK "WebContent" is eclipse specific. have the config files names to be absolute inside the WAR. It means that they will always begin with "/WEB-INF/".

这篇关于JSF面向WEB-INF外的配置文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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