error on JSP :WROX JSP professional chapter 13

Hi ,

I have these error :

When running these the webpage below i have these error message as below but when i tried to compile

CustomerInfoBean.java manually there is no problem.

=========================================

Error: 500

Location: /mutualfundco/jsp/loginStep1.jsp

Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSPC:\JBoss-2.4.1_Tomcat-3.2.3\tomcat\work\localhost_8080%2Fmutualfundco\_0002fjsp_0002floginStep_00031_0002ejsploginStep1_jsp_0.java:15: Class com.wrox.projsp.ch13.mfc.CustomerInfoBean not found in import.

import com.wrox.projsp.ch13.mfc.CustomerInfoBean;

^

1 error

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)

at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:612)

at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146)

at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:542)

at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:258)

at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:268)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)

at org.apache.tomcat.core.Handler.service(Handler.java:287)

at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)

at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)

at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)

at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)

at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)

at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)

at java.lang.Thread.run(Unknown Source)

[2164 byte] By [wikey] at [2007-9-18]
# 1
Your JSP cannot locate the bean class. Check that it is located in..../yourproject/WEB-INF/classes/com/wrox/projsp/ch13/mfc/CustomerInfoBean.class
GrayMan at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2
Still can't ,please help help help
wikey at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3
common guy's ,please help.
wikey at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4

Did u compile the source code inside the \classes directory of ur web project, and use this command?

javac -d . CustomerInfoBean.java

where the first line of ur CustomerInfoBean.java of the package should be something like this:

package com.wrox.projsp.ch13.mfc.CustomerInfoBean;

yyvoo at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5
Yes ,i did compile
wikey at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6
Can you post codes of the JSP and the bean file here?
yyvoo at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 7

Hope these will not make confuse ,suggested to copy all these code and paste to a notepad or wordpad.

=========================================

FOR JSP CODE LOCATED AT C:\JBoss-2.4.1_Tomcat-3.2.3\tomcat\webapps\mutualfundco\jsp\loginStep1.jsp

=========================================

<%@ page import = "com.wrox.projsp.ch13.mfc.CustomerInfoBean" errorPage = "errorpge.jsp" %>

<jsp:useBean id="customerInfo" class="com.wrox.projsp.ch13.mfc.CustomerInfoBean"

scope="session"/>

<jsp:setProperty name="customerInfo" property="SSN" param="SSN"/>

<html>

<head>

<title>Mutual Fund Company Login Page Step 1</title>

</head>

<body>

<p>

This is a two step process to login in to your account.

Step 1 is to enter you Social Security Number.

Step 2 asks for other data to verify that this is you.

After verification we will retrieve your profile and account summary

information.

</p>

<form method="POST">

<table cellspacing="2" cellpadding="2" border="0">

<tr>

<td>SSN</td>

<td><input type="text" name="SSN" size="9" maxlength="9"></td>

</tr>

</table>

<table cellspacing="2" cellpadding="2" border="0">

<tr>

<td><input type="submit" name="submitStep1" value="Submit"></td>

</tr>

</table>

<%

if(request.getParameter("submitStep1") != null) {

System.out.println("pressed submitStep1.");

// Put the CustomerInfoBean in the session.

session.putValue(session.getId(), customerInfo);

System.out.println("sessionId = " + session.getId());

%>

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

<%

} else {

// Called upon page load

// If the user has a session invalidate it.

session.invalidate();

System.out.println("Invalidate current session.");

// Get a new session for the user.

session = request.getSession();

System.out.println("Session creation.");

}

%>

</form>

</body>

</html>

=======================================

i)Servlet code at C:\jdk1.3.1_01\projsp.jar

ii)Under the Jar file directory is point to =

com\wrox\projsp\ch13\MFC\CustomerInfoBean.java

iii)Already make classpath to C:\jdk1.3.1_01\projsp.jar

========================================

package com.wrox.projsp.ch13.mfc;

import java.io.Serializable;

public class CustomerInfoBean implements Serializable {

private String SSN;

private String Password;

private String AccountNum;

private String ZipCode;

private String Email;

private static String cName = "CustomerInfoBean";

public CustomerInfoBean() {

System.out.println(cName + ": empty constructor.");

}

public void setSSN(String inSSN) {

String mName = new String(cName + ".setSSN(): ");

SSN = inSSN;

System.out.println(mName + "set SSN = " + SSN);

}

public String getSSN() {

return SSN;

}

public void setPassword(String inPassword) {

String mName = new String(cName + ".setPassword(): ");

Password = inPassword;

System.out.println(mName + "set Password = " + Password);

}

public String getPassword() {

return Password;

}

public void setAccountNum(String inAccountNum) {

String mName = new String(cName + ".setAccountNum(): ");

AccountNum = inAccountNum;

System.out.println(mName + "set AccountNum = " + AccountNum);

}

public String getAccountNum() {

return AccountNum;

}

public void setZipCode(String inZipCode) {

ZipCode = inZipCode;

}

public String getZipCode() {

return ZipCode;

}

public void setEmail(String inAddress) {

Email = inAddress;

}

public String getEmail() {

return Email;

}

}

wikey at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 8
where did u set the classpath? which file did u edit to set it?
tssathish at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 9
I am Using Windows NT 4.0 and set at System Environment path.
wikey at 2007-7-4 > top of java,Enterprise & Remote Computing,Web Tier APIs...