How to properly declare in a JSF page that an object is present in the session object with a given type?
I have a legacy JSF 1.0 application (using JSP, 开发者_Go百科not facelets) which I have now migrated from MyEclipse to Eclipse 3.5 Java EE, and I get a lot of errors from code similar to the following:
<f:view locale="#{foo.connection.langLocale}">
where the problem is that "foo" is explicitly inserted in the session object from Java code, and not injected by JSF or similar so Eclipse Java EE thinks "foo" is undefined and marks this as an error. What is the proper way to tell Eclipse Java EE that "foo" is perfectly fine, placed in the session object, and of type Foo?
Either declare it in faces-config.xml
as well, or disable JSP/JSF validation in Eclipse. It's an epic failure. You can do that through Window > Preferences > Web > JavaServerFaces Tools > Validation and JSP Files > Validation. Just uncheck those checkmarks in top. You can if necessary configure them less strictly over there.
The help guide lists your options for JSF Validation and EL Validation preferences.
It is likely that the only way tooling will pick up type information for beans is if they are registered in faces-config.xml
.
精彩评论