I’m trying to create an “Hello World” JSF application.
I have a bean with one field (String).
@ManagedBean (name = "beanTest")
@SessionScoped
public class BeanTest
{
private String myString = "myString";
public String getMyString()
{
return myString;
}
public void setMyString(String myString)
{
this.myString = myString;
}
}
When I’m trying to display the string value in my JSP page
<h:outputLabel value="#{beanTest.myString}"/>
In the webpage it displayed "#{beanTest.myString}" instead of "myString"
How is this caused and how can I solve it?
That can happen if your
web.xmlis declared conform Servlet 2.4 or older, or if your/WEB-INF/libfolder is cluttered with servletcontainer specific libraries likeel-api.jar, etc of an older version.Make sure that the
web.xmlroot declaraton conforms at least Servlet 2.5 or preferably the highest Servlet API version supported by your container and that the/WEB-INF/libfolder does not contain any servletcontainer specific libraries.