aspose file tools*
The moose likes JSP and the fly likes Simple Jsp-Bean problem !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Simple Jsp-Bean problem !!" Watch "Simple Jsp-Bean problem !!" New topic
Author

Simple Jsp-Bean problem !!

Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
Hello friends ,
I have already told you in earlier discussion about the problem which i am facing .I am trying to print simple hello world using BEAN but i am getting the following error:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: HelloBean
org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:122)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1051)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1079)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2230)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2236)
org.apache.jasper.compiler.Node$Root.accept(Node.java:485)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180)
org.apache.jasper.compiler.Generator.generate(Generator.java:3253)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.ClassNotFoundException: HelloBean
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1383)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1230)
org.apache.jasper.compiler.BeanRepository.getBeanType(BeanRepository.java:120)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1051)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1079)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2230)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2236)
org.apache.jasper.compiler.Node$Root.accept(Node.java:485)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2180)
org.apache.jasper.compiler.Generator.generate(Generator.java:3253)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:456)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856
I have already put everything in the right order but i am not able to resolve whats thr problem . i am hereby giving u the code to review of classes i have used

HelloBean.java
package Hello;

public class HelloBean {
private String name = "World";

public void setName(String name) {
this.name = name;
}

public String getName() {
return name;
}
}

hello1.jsp
<%@ page import="Hello.*" %>

<jsp:useBean id="hello" class="HelloBean">
<jsp:setProperty name="hello" property="*" />
</jsp:useBean>

<HTML>
<HEAD><TITLE>Hello</TITLE></HEAD>
<BODY>
<H1>
Hello, <jsp:getProperty name="hello" property="name" />
</H1>
</BODY>
</HTML>

I hope someone will surely get the solution for this.
Thanks,
Saurabh


Success is not doing extraordinary things but doing ordinary things extraordinarily well.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
try this
<jsp:useBean id="hello" class="Helo.HelloBean">
Cheers
Praful


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
Originally posted by Praful Thakare:
try this
<jsp:useBean id="hello" class="Helo.HelloBean">
Cheers
Praful


Thanks praful,
It worked with what your suggested.I guess inspite of importing the package name, we have to explictly mark the path of the class...thanks once again for ur help...
Can you suggest me some good tutorial on JSP where i can learn and get more examples than theroy..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Jsp-Bean problem !!