• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

jsp:usebean | NoClassDefFoundError

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the code to your person class and your JSP?
 
Lakshman Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks OK. Where did you put the Person.class file?
 
Lakshman Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic