Java 如何在jsf web应用程序中从依赖项jar加载资源包
我正在尝试从web应用程序中的依赖项jar加载资源包。Intellij可以解决以下问题:Java 如何在jsf web应用程序中从依赖项jar加载资源包,java,jsf,intellij-idea,gradle,Java,Jsf,Intellij Idea,Gradle,我正在尝试从web应用程序中的依赖项jar加载资源包。Intellij可以解决以下问题: #{common['key']} 但payara抛出了一个错误:“找不到基本名称common、locale de_de的bundle” 我的项目如下所示: Dependency Jar: resources / META-INF / - common.properties - faces-config.xml Web Applica
#{common['key']}
但payara抛出了一个错误:“找不到基本名称common、locale de_de的bundle”
我的项目如下所示:
Dependency Jar:
resources /
META-INF /
- common.properties
- faces-config.xml
Web Application:
resources /
- messages.properties
webapp /
WEB-INF /
- faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-bundle>
<base-name>common</base-name>
<var>common</var>
</resource-bundle>
</application>
</faces-config>
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-handler>org.omnifaces.resourcehandler.UnmappedResourceHandler</resource-handler>
<resource-bundle>
<base-name>common</base-name>
<var>common</var>
</resource-bundle>
<resource-bundle>
<base-name>messages</base-name>
<var>messages</var>
</resource-bundle>
</application>
</faces-config>
依赖项jar中的faces-config.xml如下所示:
Dependency Jar:
resources /
META-INF /
- common.properties
- faces-config.xml
Web Application:
resources /
- messages.properties
webapp /
WEB-INF /
- faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-bundle>
<base-name>common</base-name>
<var>common</var>
</resource-bundle>
</application>
</faces-config>
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-handler>org.omnifaces.resourcehandler.UnmappedResourceHandler</resource-handler>
<resource-bundle>
<base-name>common</base-name>
<var>common</var>
</resource-bundle>
<resource-bundle>
<base-name>messages</base-name>
<var>messages</var>
</resource-bundle>
</application>
</faces-config>
常见的
常见的
web应用程序中的faces-config.xml如下所示:
Dependency Jar:
resources /
META-INF /
- common.properties
- faces-config.xml
Web Application:
resources /
- messages.properties
webapp /
WEB-INF /
- faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-bundle>
<base-name>common</base-name>
<var>common</var>
</resource-bundle>
</application>
</faces-config>
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-handler>org.omnifaces.resourcehandler.UnmappedResourceHandler</resource-handler>
<resource-bundle>
<base-name>common</base-name>
<var>common</var>
</resource-bundle>
<resource-bundle>
<base-name>messages</base-name>
<var>messages</var>
</resource-bundle>
</application>
</faces-config>
org.omnifaces.resourcehandler.UnmappedResourceHandler
常见的
常见的
信息
信息
我还尝试从webapp的faces配置中删除公共资源包,但没有效果
如何访问另一个jar文件中的消息?是否已将“依赖项jar”添加到应用程序服务器上的类路径中?是的,我已添加。是否可以共享示例项目以供调查?是否已将“依赖项jar”添加到应用程序服务器上的类路径中添加到应用服务器上的类路径?是的,我这样做了。是否可以共享示例项目进行调查?