I have developed a java server page which has java server faces tags. It is fetching a bean data like this:
<h:inputText value="#{UserBean.userName}" />
But when I run it, it is showing the value as it is and not evaluating the value.
How is this caused and how can I solve it?
So, the EL expressions are not evaluated and you see
#{UserBean.userName}in the webpage instead of the evaluated value?Ensure that your
web.xmlis declared conform the maximum supported Servlet version as supported by the webcontainer. JSF 1.2 and 2.0 requires a minimum of Servlet 2.5. JSF 2.1 requires a minimum of Servlet 3.0. The Servlet version is coupled to the EL version used. JSF 1.2/2.0 rely on the new “Unified EL” (EL 2.1) which is part of Servlet 2.5.I’ll assume Servlet 2.5, here’s how the root declaration of the
web.xmlshould then look like:A bit decent IDE can autogenerate it for you if you have properly configured the project as Servlet 2.5 project and chosen a Servlet 2.5 compatible container such as at least Tomcat 6.0.