从其他项目访问托管的Bean类 [英] Access Managed bean classes from a different project
问题描述
我想从不同的 Project 1 中的 Project 2 访问@ManagedBean
,但是它的值始终为null
.我试图将src/main/webapp/META-INF/faces-config.xml
文件添加到 Project 2 中,但没有帮助.
I want to access a @ManagedBean
from Project 2 in a different Project 1, but it's value is always null
. I tried to add a src/main/webapp/META-INF/faces-config.xml
file to Project 2, but it didn't help.
Project 2 添加为.jar
.我面临的问题是.jar
不包含META-INF/faces-config.xml
文件.
Project 2 is added as a .jar
in Project 1. The issue I'm facing is that the .jar
doesn't contain the META-INF/faces-config.xml
file.
在我的maven项目构建过程中,如何将这个文件正确地添加到.jar
?
How can I have this file correctly added to the .jar
during my maven project build?
推荐答案
您需要将faces-config.xml
放在src/main/resources/META-INF
中.如果要构建.jar
,则拥有webapp
文件夹没有任何意义.
You need to place faces-config.xml
in src/main/resources/META-INF
. If you're building a .jar
, having a webapp
folder doesn't make any sense.
因此请确保您将其保存在src/main/resources/META-INF/faces-config.xml
中.
So be sure you have it in src/main/resources/META-INF/faces-config.xml
.
这篇关于从其他项目访问托管的Bean类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!