File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes encountering problem in importing java bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "encountering problem in importing java bean" Watch "encountering problem in importing java bean" New topic

encountering problem in importing java bean

Priya Sri
Ranch Hand

Joined: Mar 30, 2004
Posts: 84
we are getting compilation error in importing the java bean.
is there any error in the path we specified.
we got these errors
org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.JspCompilationContext.load(
at org.apache.jasper.servlet.JspServletWrapper.getServlet(
at org.apache.jasper.servlet.JspServletWrapper.service(
at org.apache.jasper.servlet.JspServlet.serviceJspFile(
structure of directory is
jsp file
<jsp:UseBean id="bean1" scope="request" class="Bean1">
<jsp:setProperty name="bean1" property="*" />
<title>java welcome page </title>
<h1>jsp welcome page</h1>
<b>Name :</b><% =bean1.getName() %><br>
<b>AGe: </b><% =bean1.getAge() %><br>
Java Bean
package ch03;
public class Bean1
private String name=null;
private String age=null;
public Bean1()
public String getName()
return name;
public void setName(String n)
public String getAge()
return age;
public void setAge(String ag)
Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
Instead of
<jsp:UseBean id="bean1" scope="request" class="Bean1">
Try This
<jsp:UseBean id="bean1" scope="request" class="Bean1"/>

Vijay Vaddem
Ranch Hand

Joined: Feb 13, 2004
Posts: 243
make sure that web-inf shoud be in caps and also u need to mention
the fully qualified path name while using the bean in JSP's....
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Your bean must be in a non-default package for the container to find it. No package, no import.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: encountering problem in importing java bean
jQuery in Action, 3rd edition