File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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(JspCompilationContext.java:500)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:150)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:195)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
----------------------------------------------------------------------
structure of directory is
webapps/ch03/welcome.jsp
web-inf/classes/ch03/Bean1.class
---------------------------------------------------------------
jsp file
---------------------------------------------------------------
<jsp:UseBean id="bean1" scope="request" class="Bean1">
</jsp:UseBean>
<jsp:setProperty name="bean1" property="*" />
<html>
<head>
<title>java welcome page </title>
</head>
<body>
<h1>jsp welcome page</h1>
<b>Name :</b><% =bean1.getName() %><br>
<b>AGe: </b><% =bean1.getAge() %><br>
</body>
</html>
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)
{
name=n;
}
public String getAge()
9{
return age;
}
public void setAge(String ag)
{
age=ag;
}
}
Mathews P Srampikal
Ranch Hand

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


Thanks,
Mathews
Vijay Vaddem
Ranch Hand

Joined: Feb 13, 2004
Posts: 243
Hi,
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
Marshal

Joined: Jan 10, 2002
Posts: 61770
    
  67

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: encountering problem in importing java bean