JSF does not parse tags # {}

I am new to JSP / JSF and I am having a problem with my JSP.

I have some tags that look like this:

<div class="summary"> <h:outputText escape="false" value="#{FrequencyDistManagedBean.summary}"/> </div> 

But when I browse jsp in my browser, I get the following:

  <div class="summary"> #{FrequencyDistManagedBean.summary} </div> 

It parses the h: outputText part, but not the hash / curly braces part. This does not mean that I put the value, it is never analyzed. No errors were recorded, it just doesn’t work. I can even put # {foo.bar} (expecting it to crash with some error), and that doesn't matter.

I have a surf servlet mapped to / faces / * (or by default) and my urls look like this: http://www.mysite.com:8080/MyProject/faces/FrequencyDist.jsp (I am running Tomcat 6 and using JSF 1.2)

What am I doing wrong?

+4
source share
2 answers

In this old SO question, change the version of the web.xml file to 2.5:

 <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> 

Also set <faces-config ... version="1.2">

Googling for jsf not evaluating el expression places this link at the top of the search results.


Not related to your immediate problem, but you will soon come across this:

Confirm the use of the bean controller name; I mean the uppercase F at the beginning of the FrequencyDistManagedBean . By default, bean names always begin with lowercase letters. You must follow the same convention when explicitly specifying a bean.

+2
source

Nevermind, removed doctype and replaced the faces-config element with the following:

 <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"> 

You seem, thank you for your help!

+1
source

All Articles