Seam2.2.0GA facesMessages.addFromResourceBundle() doesn't work with JBoss5.1.0GA
It seems a bug of Seam2.2.0GA or I missed something, here is the senario: use seam-gen generated the dummy project, change the AuthenticatorBean.java in the hot folder:
add:
@In FacesMessages facesMessages;
public boolean authenticate() {
...
facesMessages.addFromResourceBundle("hello");
}
also change the
.war/WEB-INF/classes/messages_en.properties
, added new line:
hello="this is the test messages";
now deploy this on JBoss4.2.3GA, and goto http://localhost:8080/{projectname}/login.seam, click submit, it will show the correct messages on top of the page.
deploy same ear on JBoss5.1.0GA, click submit on login.seam, it will show "hello" instead of the real messages.
on JBoss4.2.3GA, even delete the jboss-app.xml from .ear/META-INF/ folder, it still works fine. on JBoss5.1.0GA, no matter add/delete/change to use jboss-app5.dtd, it doesn't work at all.
This is only happened when I tried to use 开发者_高级运维faceMessages in the EJB. seems the JBoss5.1 classloader has different behaviours than JBoss4.2.x? Really need helps.
The recommended way to add messages in Seam 2.2 is to use StatusMessages instead of FacesMessages. Some of the methods in the FacesMessages class are already deprecated, check the seam documentation and javadoc.
Yes as kpolice is saying you should use
StatusMessages.instance().addFromResourceBundle("whatnot");
FacesMessages is deprecated
精彩评论