• 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

Now J2EE - plzzzzzzzzzzzzz help

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friends,
I left tomcat and now have installaed j2ee server.
I want to try a simple jsp with a java bean. here is the code for both
JSP/// TestJSP.jsp
<jsp:useBean id="name" class="JavaBean" />
<html>
<body>
<%= name.getName() %>
</body>
</html>
JavaBean// JavaBean.java
public class JavaBean
{
private String myName;
public JavaBean()
{
myName = "Pradeep Kanwar";
}
public String getName()
{
return myName;
}
public void setName(String name)
{
myName = name;
}
}
I've put JSP in j2sdkee1.3\public_html file and put bean in j2sdkee1.3\lib\classes
When i access it with http://localhost:8000/TestJSP.jsp, i get the following error:

org.apache.jasper.JasperException: Unable to compile class for JSPc:\j2sdkee1.3\repository\aravali\web\_0002fTestJSP_jsp.java:57: Class org.apache.jsp.JavaBean not found.
JavaBean name = null;
^
c:\j2sdkee1.3\repository\aravali\web\_0002fTestJSP_jsp.java:60: Class org.apache.jsp.JavaBean not found.
name= (JavaBean)
^
c:\j2sdkee1.3\repository\aravali\web\_0002fTestJSP_jsp.java:65: Class org.apache.jsp.JavaBean not found.
name = (JavaBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "JavaBean");
^
Friends, plz let me know where i am wrong.
Thanks a ton in advance
pradi
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Instead of copying files directly to target directories, I recommend you use "c:\j2sdkee1.3\bin\deploytool" to deploy your enterprise application. There's a good tutorial on how to assemble and deploy J2EE applications using deploytool at http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/GettingStarted.html .
Good luck.
------------------
Miftah Khan
- Sun Certified Programmer for the Java� 2 Platform
- Sun Certified Web Component Developer for the Java� 2 Platform, Enterprise Edition
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Aren't beans supposed to have a no-param's constructor that calls super()?
Bye,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason you're getting the "Class org.apache.jsp.JavaBean not found" error is because JavaBean was not placed in a package. As a result, jsp:useBean is looking for it in the default JSP package (org.apache.jsp) and, of course, it's not finding it there.
[This message has been edited by Miftah Khan (edited October 21, 2001).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic