• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp cannot call bean in websphere application server

 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


hi everybody. i am chaitanya. i am working on websphere server. i have a serious problem and i am tired. please help me.
my jsp page is unable to get the bean. i am using eclipse to code the beans and jsps. my folder structure is like this

webcontent(root_folder)
|
|__bean(folder)
| |
| |__SimpleBean.class
|
|__meta-inf(folder)
|
|__web-inf(folder)
|
|__sample.jsp


this is the error i got. please help me.

org.apache.jasper.JasperException: /sample.jsp(10,0) The value for the useBean class attribute bean.SimpleBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Generator.generate(Generator.java:3270)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)


my jsp page looks like this:

sample.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<jsp:useBean id="test" class="bean.SimpleBean" />---------------------------------------------here lies the error.eclipse is saying bean cannot be resolved to a type
<jsp:setProperty name="test" property="name" value="karthik" />
<jsp:getProperty name="test" property="name" />
</body>
</html>

my bean looks like this.

SimpleBean.java

package bean;

public class SimpleBean implements java.io.Serializable
{
private String name="";
SimpleBean(){}
public void setName(String name)
{
this.name=name;
}
public String getName(String name)
{
return(name);
}
}
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per my knowledge classes should be under web-inf\classes folder. So considering your case bean folder should be under WEB-INF\classes folder.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried every thing. but the result is same. i pasted my class file under build/classes/bean/SimpleBean and under web-inf/classes/bean/SimpleBean
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and more over in eclipse under web-inf folder there is no folder named classes. i manually had created one folder named classes and pasted my folder under it. then also the same problem continued.
the next time i pasted my folder under lib. then also the same problem continued
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody, thanks for all of you for being with me and suggesting me, the problem is solved
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic