• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with jsp:useBean ...Pl help

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic