File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes EL expressions are not evaluated Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "EL expressions are not evaluated " Watch "EL expressions are not evaluated " New topic

EL expressions are not evaluated

krishan go

Joined: May 20, 2011
Posts: 8

My inputname.jsp file

<%@ taglib uri="" prefix="h" %>
<%@ taglib uri="" prefix="f" %>

<title>enter your name page</title>
<h: outputText value="JSF 1.2 Tutorial"/>
<h:form id="UserEntryForm">
<h: outputText value="Enter Your Name:"/>
<h:inputText value="#{UserBean.userName}" />
<h:commandButton action="welcome" value="OK" />

My welcome.jsp file
<%@ taglib uri="" prefix="h" %>
<%@ taglib uri="" prefix="f" %>
<h: outputText value="Welcome" />,
<hutputText value="#{UserBean.userName}" /> to JSF 1.2 World!

my web.xml file

<?xml version='1.0' encoding='UTF-8'?>
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"


<!-- Faces Servlet -->
<servlet-name>Faces Servlet</servlet-name>
<load-on-startup> 1 </load-on-startup>

<!-- Faces Servlet Mapping -->
<servlet-name>Faces Servlet</servlet-name>


my faces-config file

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"




my file

package net.roseindia;

public class UserNameBean {

String userName;

* @return User Name
public String getUserName() {
return userName;

* @param User Name
public void setUserName(String name) {
userName = name;

when i open inputname.jsf i get
Enter your name: #{UserBean.userName}

instead of evaluating userbean.username it is just printing it
same happens at welcome.jsf
i get Welcome, #{UserBean.userName} to JSF 1.2 World!

what am i doing wrong
Please help
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

RoseIndia isn't what it used to be.

First off, don't name beans with an uppercase first letter. Names starting in uppercase should be class names, names starting in lowercase are instance names. JSF will start to give you problems with that once you move to JSF2.

From the looks of it, you're mistaking the filename for the URL. If you request the page as "inputname.jsp", the URL parser won't route the request to the FacesServlet and the EL won't be evaluated. The tags shouldn't work, either, but HTML ignores tags it doesn't understand, so you generally wouldn't see anything wrong there.

To route the request to the FacesServlet, your URL should be either "faces/inputname.jsp" or "inputname.jsf". Which URL form you use depends on what URL matching pattern for FacesServlet is defined in your web.xml file.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: EL expressions are not evaluated
It's not a secret anymore!