Unable to compile class for JSP

Hi this is my opening page

<html>

<head>

<title> Customer Registration </title>

</head>

<body>

<center> <h1> Customer Registration </h1> </center>

<form action = "forward.jsp" method ="Post">

<input type="Submit" name="Submit" value="Submit Request">

</form>

</html>

this forward.jsp

<%@page import="TechSupportBean" %>

<jsp:useBean id="techSupportBean" scope="session" type="TechSupportBean"/>

<jsp:forward page="regForm.jsp"/>

my TechSupportBean.classs is in %tomcat_home%\webapps\tech\WEB-INF\classes

but iam getting the error :

Unable to compile class for JSP

Generated servlet error:

The import TechSupportBean cannot be resolved

please help me out

[908 byte] By [rajujadhava] at [2007-10-3 11:13:57]
# 1
your class should be in a package
jgalacambraa at 2007-7-15 13:37:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
yes i have changed to and also in my myapp dir<%@page import="myclass.TechSupportBean" %>but now i am getting another error:bean techSupportBean not found within scope
rajujadhava at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
your scope is session try to use request
jgalacambraa at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
still not workinng
rajujadhava at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
<jsp:useBean id="techSupportBean" scope="session" type="TechSupportBean"/> should be<jsp:useBean id="techSupportBean" scope="request" type="mypackage.TechSupportBean"/>
jgalacambraa at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
yes I have changed to<%@page import="myclass.TechSupportBean" %><jsp:useBean id="techSupportBean" scope="request" type="myclass.TechSupportBean"/><jsp:forward page="regForm.jsp"/>still getting the same error
rajujadhava at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

error:

org.apache.jasper.JasperException: Exception in JSP: /forward.jsp:3

1: <%@page import="myclass.TechSupportBean" %>

2:

3: <jsp:useBean id="techSupportBean" scope="request" type="myclass.TechSupportBean"/>

4:

5:

6: <jsp:forward page="regForm.jsp"/>

Stacktrace:

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: bean techSupportBean not found within scope

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)

org.apache.jsp.forward_jsp._jspService(forward_jsp.java:66)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.InstantiationException: bean techSupportBean not found within scope

org.apache.jsp.forward_jsp._jspService(forward_jsp.java:49)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

rajujadhava at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8

2.jsp

<%@ page contentType="text/html;charset=windows-1252"%>

<jsp:useBean id="mybean" class="main.Sample" scope="request"/>

<jsp:setProperty name="mybean" property="*"/>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>untitled</title>

</head>

<body>

<jsp:getProperty name="mybean" property="username" />

<jsp:getProperty name="mybean" property="password" />

</body>

</html>

Sample.java

package main;

public class Sample

{

private String username;

private String password;

public Sample()

{

setUsername("none");

setPassword("none");

}

public String getUsername()

{

return username;

}

public void setUsername(String username)

{

this.username = username;

}

public String getPassword()

{

return password;

}

public void setPassword(String password)

{

this.password = password;

}

}

jgalacambraa at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
replace "type" with "class" and try..<jsp:useBean id="techSupportBean" scope="request" class="myclass.TechSupportBean"/>
enda at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10

Hi this is my opening page

<html>

<head>

<title> Customer Registration </title>

</head>

<body>

<center> <h1> Customer Registration </h1> </center>

<form action = "forward.jsp" method ="Post">

<input type="Submit" name="Submit" value="Submit Request">

</form>

</html>

this forward.jsp

<%@page import="myclass.TechSupportBean" %>

<jsp:useBean id="techSupportBean" scope="session" class="myclass.TechSupportBean"/>

<% if (techSupportBean.isRegistered) { %>

<jsp:forward page="regForm.jsp"/>

<% } %>

and TechSupportBean.class

package myclass;

import java.sql.*;

public class TechSupportBean {

public TechSupportBean() {

}

private boolean registered;

public boolean isRegistered () {

registered = true;

return registered;

}

}

my TechSupportBean.classs is in %tomcat_home%\webapps\tech\WEB-INF\classes\myclass

but iam getting the error :

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 6 in the jsp file: /forward.jsp

Generated servlet error:

techSupportBean.isRegistered cannot be resolved or is not a field

rajujadhava at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11
did you get solution to your problem ? i am also getting the same error
mujjia at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12

Hi,

I'm getting the following error when trying to update a customer page in my project.I'm using tomcat4.1,orace 10g as database.

type Exception report

message

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:

[javac] Compiling 1 source file

C:\apache-tomcat-4.1.34\work\Standalone\localhost\bank\CombinedError_jsp.java:7: package project does not exist

import project.InvalidCustomer;

^

C:\apache-tomcat-4.1.34\work\Standalone\localhost\bank\CombinedError_jsp.java:8: package project does not exist

import project.InvalidAccount;

^

C:\apache-tomcat-4.1.34\work\Standalone\localhost\bank\CombinedError_jsp.java:9: package project does not exist

import project.InvalidAmount;

^

C:\apache-tomcat-4.1.34\work\Standalone\localhost\bank\CombinedError_jsp.java:10: package project does not exist

import project.InsufficientBalance;

^

C:\apache-tomcat-4.1.34\work\Standalone\localhost\bank\CombinedError_jsp.java:11: package project does not exist

import project.ClosedAccountException;

^

5 errors

Here i'm attaching my jsp file

<%--

* This jsp file catches all the exception thrown by the program

* and displays message accordingly.

* @author: Shalini

* @param exception that occur in the program.

* @returns error page

* Date :19-10-2005

--%>

<%--

* import statements required for this jsp page.

--%>

<%@ page import="project.InvalidCustomer" %>

<%@ page import="project.InvalidAccount" %>

<%@ page import="project.InvalidAmount" %>

<%@ page import="project.InsufficientBalance" %>

<%@ page import="project.ClosedAccountException" %>

<%@ page isErrorPage = "true" %>

<%@ page session="true" %>

<% String s=session.getId();

Integer isValid=(Integer)session.getAttribute("Valid");

Integer count=(Integer)session.getAttribute("Count");

Integer previous=(Integer)session.getAttribute("Prev");

if(isValid!=null)

{

isValid=new Integer(previous.intValue());

session.setAttribute("Valid",isValid);

%>

<html>

<head>

<title>Infy Bank - Error</title>

<link rel="stylesheet" type="text/css" href="commonstyle.css">

<table cellpadding="10" cellspacing="3" align="center">

<tr>

<td><img src=

"C:\Documents and Settings\sarath_g\Desktop\logo.jpg"/>

</tr>

</table>

</head>

<body>

<center>

<%

String errorMessage = exception.toString();

String errorName="";

int colIndex = errorMessage.indexOf(':');

if (colIndex == -1)

errorName=errorMessage;

else

errorName = errorMessage.substring(0,colIndex);

if(errorName.equals("java.lang.NumberFormatException"))

{%>

<h1>

<font color="red">ERROR!!!</font>

</h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">Invalid Number Format</font>

</h2>

</td>

</center>

</tr>

</table>

<%}

else if(errorName.equals("project.InvalidCustomer"))

{ %>

<h1><font color="red">ERROR!!!</font></h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">Invalid Customer ID</font>

</h2>

</td>

</center>

</tr>

</table>

<% }

else if(errorName.equals("project.InvalidAmount"))

{ %>

<h1>

<font color="red">ERROR!!!</font>

</h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">Invalid Amount</font>

</h2>

</td>

</center>

</tr>

</table>

<% }

else if(errorName.equals("project.InsufficientBalance"))

{%>

<h1>

<font color="red">ERROR!!!</font>

</h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">Insufficient Balance</font>

</h2>

</td>

</center>

</tr>

</table>

<% }

else if(errorName.equals("project.InvalidAccount"))

{ %>

<h1>

<font color="red">ERROR!!!</font>

</h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">No Account exists</font>

</h2>

</td>

</center>

</tr>

</table>

<% }

else if(errorName.equals("project.ClosedAccountException"))

{ %>

<h1>

<font color="red">ERROR!!!</font>

</h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">

Sorry!!Account has been closed.

Transaction not possible

</font>

</h2>

</td>

</center>

</tr>

</table>

<% }

else if(errorName.equals("java.sql.SQLException"))

{ %>

<h1>

<font color="red">ERROR!!!</font>

</h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">Invalid data entry..<%=exception.getLocalizedMessage()%></font>

</h2>

</td>

</center>

</tr>

</table>

<% }

else if(exception.getLocalizedMessage().equals("Infy password policy violation"))

{%>

<h1><font color="red"><marquee>ERROR!!!</marquee></font></h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">

<%out.print("Infy Bank Password Policy violated.Your new password");%>

<%out.print("should contain atleast 8 characters and also it");%>

<%out.print("should contain atleast 3 of following 4 groups:");%>

<%out.print("1.English Upper Case Characters(A - Z)");%>

<%out.print("2.English Lower Case Characters(a - z)");%>

<%out.print("3.Numerals(0-9)");%>

<%out.print("4.Special characters(#,@,!..etc).");%>

</font>

</h2>

</td>

</center>

</tr>

</table>

<%}

else if(exception.getLocalizedMessage().equals("Confirmation required"))

{%>

<h1><font color="red"><marquee>ERROR!!!</marquee></font></h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">

<%out.print(" The passwords given doesn't match.");%>

</font>

</h2>

</td>

</tr>

<tr>

<td>

<h2>

<font color="red">

<%out.print("Please fill new password in both the fields");%>

</font>

</h2>

</td>

</center>

</tr>

</table>

<%}

else if(exception.getLocalizedMessage().equals("Wrong password"))

{%>

<h1><font color="red"><marquee>ERROR!!!</marquee></font></h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">

<%out.print("your username or oldpassword is not correct.");%>

<%out.print("password field must be typed in correct case.");%>

</font>

</h2>

</td>

</center>

</tr>

</table>

<%}

else

{%>

<h1><font color="red">ERROR!!!</font></h1>

<hr>

<table bgcolor="red">

<tr>

<center>

<td colspan="2">

<h2>

<font color="red">

<%out.print(exception.getLocalizedMessage());%>

</font>

</h2>

</td>

</center>

</tr>

</table>

<% } %>

<input type="button" name="back" value="Back" onclick="history.go(-1)">

</center>

</body>

</html>

<%}%>

It gives the error that the package project doesn't exist.I have all my jsp files ,java files and the proj.jar file in the C:\project folder and i have included my proj.jar in the classpath.

my server.xml file includes

<Context path="/bank" docBase="C:\project" debug="0"

reloadable="true" crossContext="true">

if anyone knows how to solve this error plz reply.

Thanks

shal22a at 2007-7-15 13:37:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...