skiabox 0 Light Poster

I am trying to run a relatively simple jsp page but I am getting the following error :

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /dateBean.jsp (line: 7, column: 4) The value for the useBean class attribute com.apress.projsp.DateFormatBean is invalid.
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1234)
	org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1182)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
	org.apache.jasper.compiler.Generator.generate(Generator.java:3490)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:250)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:644)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.19 logs.

The jsp page is the following :

<html>
    <head>
      <title>Professional JSP 2, 4th Edition</title>
      <link rel="stylesheet" href="projsp.css">
    </head>
  <body>
    <jsp:useBean id="date" class="com.apress.projsp.DateFormatBean"/>
    <h2>Today's Date is <%= date.getDate()%></h2>
  </body>
</html>

and the class source code is the following :

package com.apress.projsp;

import java.util.Date;
import java.text.*;

public class DateFormatBean implements java.io.Serializable{
  private DateFormat dateFormat;
  private Date date;

  public DateFormatBean() {
    dateFormat = DateFormat.getInstance();
    date = new Date();
  }

  public String getDate() {
    return dateFormat.format(date);
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public void setFormat(String format) {
    this.dateFormat = new SimpleDateFormat(format);
  }
}

All files are in their proper position and ant was used to compile the project.
Tomcat version 7 is also used.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.