user1602187
user1602187

Reputation: 73

JSF not parsing #{} tags

I'm new to JSP/JSF and I've run into a problem with my JSP.

I have several tags that look like this:

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

But when I view the jsp in my browser, I get this:

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

It parses the h:outputText part, but not the hash/curly braces part. It doesn't mater what I put for the value, it never gets parsed. No errors logged, it just doesn't work. I can even put #{foo.bar} (expecting it to fail with some kind of error) and it makes no difference.

I have the faces servlet mapped to /faces/* (or whatever the default is), and my urls look like: http://www.mysite.com:8080/MyProject/faces/FrequencyDist.jsp (I'm running Tomcat 6, and using JSF 1.2)

What am I doing wrong ?

Upvotes: 4

Views: 756

Answers (2)

user1602187
user1602187

Reputation: 73

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

<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 rock, thankyou very much for your help!!

Upvotes: 1

Richard Sitze
Richard Sitze

Reputation: 8463

Per this older SO question, change your web.xml file's version 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 put that link at the top of the search results.


Not related to your immediate problem, but you'll run right into this soon:

Verify your use of the controller bean name; I'm referring to the upper-case F at the beginning of FrequencyDistManagedBean. By default bean names always begin with lower-case letters. You should follow the same convention when you explicitly name a bean.

Upvotes: 2

Related Questions