Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Plz help not able to run simple JSP and Bean  RSS feed

 
Pradeep Kanwar
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friends,
I tried a lot on tomcat but no success and left it. Now on J2EE server .. still no success.
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!