File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with jsp:useBean ...Pl help

 
Gopi Krishna
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic