Cannot execute my first JSF Program
Hey all. I am trying to execute my first JSF program but i get this output on the browser when i try to run my login.jsp file through tomcat version 5.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfillingthis request.
exception
org.apache.jasper.JasperException: /login.jsp(17,0) According to the TLD attributefor is mandatoryfor tag outputLabel
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:274)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:722)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:759)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:759)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:759)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1458)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2226)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2232)
org.apache.jasper.compiler.Node$Root.accept(Node.java:485)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2176)
org.apache.jasper.compiler.Validator.validate(Validator.java:1515)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:253)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:459)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:142)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
Here is my login.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!DOCTYPE html PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Page</title>
<f:loadBundle basename="com.tutorial.messages" var="msg"/>
</head>
<body>
<h:form>
<h:messages layout="table"></h:messages>
<h:panelGrid columns ="2">
<h:outputLabel rendered="true" value="#{msg.name}"></h:outputLabel>
<h:inputText value ="#{loginBean.name}"></h:inputText>
<h:outputLabel rendered="true" value ="#{msg.password}"></h:outputLabel>}
<h:inputSecret value="#{loginBean.password.convertedId}">
<f:converter converterId="javax.faces.Long"></f:converter >
<f:validator validatorId="com.tutorial.validatePassword"></f:validator >
<h:commandButton action="login" value="Login"></h:commandButton>
</h:inputSecret>
</h:panelGrid>
<h:commandButton action ="login" value ="#{msg.login}"></h:commandButton>
</h:form>
</f:view>
</body>
</html>
Here is my welcome.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!DOCTYPE html PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
<f:loadBundle basename="com.tutorial.messages" var ="msg"/>
</head>
<body>
<f:view>
<h:form>
<h:outputLabel value ="#{msg.welcome} #{loginBean.name }"></h:outputLabel>
</h:form>
</f:view>
</body>
</html>
I have a LoginBean class which is simple and i am sure nothing is wrong in that. the stack trace tells me that my outputLabel in jsp is not right? but by searching on goole and the tutorial i dont see anything wrong. here is my faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<managed-bean>
<managed-bean-name>
loginBean</managed-bean-name>
<managed-bean-class>
com.tutorial.LoginBean</managed-bean-class>
<managed-bean-scope>
session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<display-name>
login</display-name>
<from-view-id>
/login.jsp</from-view-id>
<navigation-case>
<from-outcome>
login</from-outcome>
<to-view-id>
/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<validator>
<display-name>
Validate Password</display-name>
<validator-id>
com.tutorial.validatePassword</validator-id>
<validator-class>
com.tutorial.validatePassword</validator-class>
</validator>
</faces-config>
Thank you so much for looking into it.

