aspose file tools*
The moose likes Servlets and the fly likes problem with jsp:useBean ...Pl help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with jsp:useBean ...Pl help" Watch "problem with jsp:useBean ...Pl help" New topic
Author

problem with jsp:useBean ...Pl help

Gopi Krishna
Greenhorn

Joined: Jan 25, 2001
Posts: 10
Hi I am trying to use beans in JSP. I am using Weblogic 5.1
Getting this error
Parsing of JSP File '/test.jsp' failed:
--------------------------------------------------------------------------------
/test.jsp(9): Could not create a bean of type: SimpleBean: java.lang.ClassNotFoundException: Error definining SimpleBean
probably occurred due to an error in /test.jsp line 9:
<jsp:useBean id="demo" scope="session" class="SimpleBean" />

Here is bean code:
public class SimpleBean {
private String result;
public String getInfo( ) {
return "this is simple bean";
}
}
here is jsp page

bean time now is :
<%= new java.util.Date() %>
<jsp:useBean id="demo" scope="session" class="SimpleBean" />
<jsp:getProperty name="demo" property="info" />
--------------
Please help me in why I am getting this error. Where should I place my bean classes.
I am placing my JSPs and bean classes both in D:\weblogic51\myserver\public_html
thanks in advance
Gopikrishna
Bala Krishna
Ranch Hand

Joined: Jan 26, 2001
Posts: 95
Gopi,
Try placing your files in :\weblogic\myserver\classroot.
that's where I put my .class files that will be accessed by my JSP Pages. If that does not work, please go through weblogic's documentation. you will find your answer there.
thx.
Gopi Krishna
Greenhorn

Joined: Jan 25, 2001
Posts: 10
Thanks Bala Krishna
what do you mean by classroot ? Because there is no classroot directory.
And from Error log (from screen )
Thu Feb 08 14:34:48 PST 2001:<I> <ServletContext-General> *.jsp: initialization complete
Thu Feb 08 14:34:49 PST 2001:<I> <ServletContext-General> Generated java file: D:\weblogic51\myserve
r\classfiles\jsp_servlet\_test.java
Thu Feb 08 14:34:52 PST 2001:<E> <ServletContext-General> Compilation of D:\weblogic51\myserver\clas
sfiles\jsp_servlet\_test.java failed: D:\weblogic51\myserver\classfiles\jsp_servlet\_test.java:75: C
lass jsp_servlet.SimpleBean not found.
SimpleBean demo = (SimpleBean) //[ /test.jsp; Line: 9]
^
D:\weblogic51\myserver\classfiles\jsp_servlet\_test.java:75: Class jsp_servlet.SimpleBean not found.
SimpleBean demo = (SimpleBean) //[ /test.jsp; Line: 9]
^
D:\weblogic51\myserver\classfiles\jsp_servlet\_test.java:81: Class jsp_servlet.SimpleBean not found.
demo = (SimpleBean) java.beans.Beans.instantiate(getClass().getClassLoader(), "S
impleBean"); //[ /test.jsp; Line: 10]
Originally posted by Bala Krishna:
Gopi,
Try placing your files in :\weblogic\myserver\classroot.
that's where I put my .class files that will be accessed by my JSP Pages. If that does not work, please go through weblogic's documentation. you will find your answer there.
thx.

Bala Krishna
Ranch Hand

Joined: Jan 26, 2001
Posts: 95
If you do not have this directory, you can create one, under myserver. This is the default directory where weblogic searches for the non-reloadable classes(depending on the document root property in your weblogic.properties file, of course). Create this directory, compile your java beans to place to the .class files in this directory and place your jsp files in public_html directory. That should do it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with jsp:useBean ...Pl help