beans

Hello,

I have jsp page:

<BODY>

<H1>Thanks for Registering</H1>

<jsp:useBean id="nameBean" type="NameBean"

scope="session" />

<H2>First Name:

<jsp:getProperty name="nameBean" property="firstName" /></H2>

<H2>Last Name:

<jsp:getProperty name="nameBean" property="lastName" /></H2>

</BODY></HTML>

and a NameBean class in WEB-INF/classes folder, but when i try to run this jsp page on my local host it cant find the NameBean class.Why?

Thanks

[591 byte] By [Lanexx] at [2007-9-30 23:28:54]
# 1
does it have a package statement in it?
javajugs at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...
# 2
No, it doesn't.
Lanexx at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...
# 3
may be u have to specify the type as type="/WEB-INF/classes/yourclassname"
sienfield at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...
# 4
I still get classNotFound exception
Lanexx at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...
# 5

Something like:

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

An error occurred at line: 9 in the jsp file: /RandomNum.jsp

Generated servlet error:

[javac] Compiling 1 source file

C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\_\RandomNum_jsp.java:49: cannot resolve symbol

symbol : class NumberBean

location: class org.apache.jsp.RandomNum_jsp

NumberBean randomNum = null;

^

Lanexx at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...
# 6
is this ur NameBean class path ?/WEB-INF/classes/NameBean and u used the type with that thingy above?s
sienfield at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...
# 7

> org.apache.jasper.JasperException: Unable to compile

> class for JSP

>

> An error occurred at line: 9 in the jsp file:

> /RandomNum.jsp

>

> Generated servlet error:

>[javac] Compiling 1 source file

>

> C:\jakarta-tomcat-4.1.31\work\Standalone\localhost\_\R

> andomNum_jsp.java:49: cannot resolve symbol

> symbol : class NumberBean

> location: class org.apache.jsp.RandomNum_jsp

>NumberBean randomNum = null;

>^

? This is clearly to do with NumberBean, not NameBean. Are you aware that JSPs are compiled into servlets at runtime? This is a compile error, it can't find that class... read the errors

javajugs at 2007-7-7 14:31:55 > top of Java-index,Security,Event Handling...