Gregg,
I received this error when I was starting tomcat. Yes, I believe I have
all the jar files and have verified the code against the tutorial.
If you see anything wrong with the code or the setup, pls. let me know.
Thanks!
BL
Here's the directory structure of the JSF under tomcat:
webapps
|->jsfks
|->
ant - contains build.xml
|->JavaSource
|->bundle - contains Message.properties
|
|->jsfks - contains PersonBean.java
|
|->WebContent
|->pages - contains greeting.jsp, index.jsp and inputname.jsp
|
|->WEB-INF
|->classes
| |->bundle - contains Message.properties
| |
| |->jsfks - contains PersonBean.class
|
|->lib - contains commons-beanutils.jar,commons-collections.jar,commons-digester.jar
commons-logging.jar, jsf-api.jar, jsp-impl.jar, jsf-ri.jar, jstl.jar,
standard.jar
===============================================================================
build.xml:
roject name="jsjks" basedir="../" default="deploy">
<!-- Project settings -->
<property name="project.distname" value="jsfks"/>
<!-- define your folder for deployment -->
<property name="deploy.dir" value="deploy"/>
<!-- Local system paths -->
<property file="${basedir}/ant/build.properties"/>
<property name="webroot.dir" value="${basedir}/WebContent"/>
<property name="webinf.dir" value="${webroot.dir}/WEB-INF"/>
<property name="build.dir" value="build"/>
<!-- classpath -->
<path id="compile.classpath">
<pathelement path ="${webinf.dir}/lib/jsf-api.jar"/>
<pathelement path ="${webinf.dir}/lib/jsf-impl.jar"/>
<pathelement path ="${classpath}"/>
</path>
<!-- Check timestamp on files -->
<target name="prepare">
<tstamp/>
</target>
<!-- Copy any resource or configuration files -->
<target name="resources">
<copy todir="${webinf.dir}/classes" includeEmptyDirs="no">
<fileset dir="JavaSource">
<patternset>
<include name="**/*.conf"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
</patternset>
</fileset>
</copy>
</target>
<!-- Normal build of application -->
<target name="compile" depends="prepare,resources">
<javac srcdir="JavaSource" destdir="${webinf.dir}/classes">
<classpath refid="compile.classpath"/>
</javac>
</target>
<!-- Remove classes directory for clean build -->
<target name="clean"
description="Prepare for clean build">
<delete dir="${webinf.dir}/classes"/>
<mkdir dir="${webinf.dir}/classes"/>
</target>
<!-- Build entire project -->
<target name="build" depends="prepare,compile"/>
<target name="rebuild" depends="clean,prepare,compile"/>
<!-- Create binary distribution -->
<target name="war" depends="build">
<mkdir dir="${build.dir}"/>
<war
basedir="${webroot.dir}"
warfile="${build.dir}/${project.distname}.war"
webxml="${webinf.dir}/web.xml">
<exclude name="WEB-INF/${build.dir}/**"/>
<exclude name="WEB-INF/src/**"/>
<exclude name="WEB-INF/web.xml"/>
</war>
</target>
<target name="deploy" depends="war">
<delete file="${deploy.dir}/${project.distname}.war"/>
<delete dir="${deploy.dir}/${project.distname}"/>
<copy file="${build.dir}/${project.distname}.war" todir="${deploy.dir}"/>
</target>
</project>
===============================================================================
Messages.properties:
inputname_header=JSF KickStart
prompt=Tell us your name:
greeting_text=Welcome to JSF
===============================================================================
PersonBean.java:
package jsfks;
public class PersonBean {
String userName;
/**
* @return User Name
*/
public String getUserName() {
return userName;
}
/**
* @param User Name
*/
public void setUserName(String name) {
userName = name;
}
}
===============================================================================
greeting.jsp:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:loadBundle basename="bundle.Messages" var="Message"/>
<html>
<head> <title>Greeting Page</title> </head>
<body>
<f:view>
<h3>
<h
utputText value="#{Message.greeting_text}" />,
<h
utputText value="#{PersonBean.userName}" />!
</h3>
</f:view>
</body>
</HTML>
===============================================================================
index.jsp:
<html>
<body>
<
jsp:forward page="faces/pages/inputname.jsp" />
</body>
</html>
===============================================================================
inputname.jsp:
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<f:loadBundle basename="bundle.Messages" var="Message"/>
<HTML>
<HEAD> <title>Input Name Page</title> </HEAD>
<body>
<f:view>
<h1><h
utputText value="#{Message.inputname_header}"/></h1>
<h:messages style="color: blue"/>
<h:form id="helloForm">
<h
utputText value="#{Message.prompt}"/>
<h:inputText id="userName" value="#{PersonBean.userName}" required="true">
<f:validateLength minimum="2" maximum="10"/>
</h:inputText>
<h:commandButton id="submit" action="sayhello" value="Say Hello" />
</h:form>
</f:view>
</HTML>