| Author |
jsp:usebean | NoClassDefFoundError
|
Lakshman Kumar
Greenhorn
Joined: Jan 05, 2007
Posts: 8
|
|
Hi ranchers, i have question. I added a 'person' object to the request attribute in a servlet and forwarded the request to a jsp. In jsp when i used request.getAttribute("person") its woking fine. But the problem is with <jsp:useBean>, when this is used i'm getting NoClassDefFoundError: Person (Wrong name foo/Person). (But if the same code is replaced with request.getAttribute(..) its working fine). I imported foo.Person in the Jsp file. Please help me to solve this...thanks in advance Lakshman [ July 17, 2007: Message edited by: Lakshman Kumar ]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Can you post the code to your person class and your JSP?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Lakshman Kumar
Greenhorn
Joined: Jan 05, 2007
Posts: 8
|
|
I set the instance of the Person class to the request attribute in a servlet and forwarded to the below jsp (result.jsp) Here is my jsp code: result.jsp ********** <%@ page import="foo.Person"> <html> <body> <jsp:useBean id="person" class="foo.Person" scope="request" /> Name : <jsp:getProperty name="person" property="name" /> </body> </html> Person.java *********** package foo; public class Person { private name; public setName(String n) { this.name=n; } public getName() { return name; } } Please reply.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
This looks OK. Where did you put the Person.class file?
|
 |
Lakshman Kumar
Greenhorn
Joined: Jan 05, 2007
Posts: 8
|
|
Hi Ben, Now it is working. The mistake i have done is in the jsp:useBean i did not give the package structure of the Person class. Any how...Thanks a lot. Lakshman.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: jsp:usebean | NoClassDefFoundError
|
|
|