JSP <jsp:usebean>问题,新手求大侠帮忙

wickson592520 2010-05-14 10:17:27
我是用Myeclipse写程序的,我创建了一个web project,命名位Jsp1,它自动生成了一个crs的文件夹和一个WebRoot的文件夹。然后我又新建了一个JSP(Advanced Templates),命名位jspbeanjsp,它被自动放到了WebRoot文件夹里。
我创建了一个www.bag的包,被自动放到crs这个文件夹里,我在www.bag里新建了一个类JspBean1。
jspbeanjsp.jsp 代码

<%@ page contentType="text/html; charset=GB2312" %>
<html>
<head>
<title>My JSP 'jspbeanjsp.jsp' starting page</title>
</head>
<h1>JavaBean动作</h1>
<jsp:useBean id="JspBean1ID"scope="page"class="www.bag.JspBean1" />
<h2>属性sampl的初始值:
<jsp:getProperty name="JspBean1ID"property="sampl"/></h2>
<jsp:setProperty name="JspBean1ID"property="sampl" value="***新属性***"/>
<body>
<h2>属性sampl的新值:
<jsp:getProperty name="JspBean1ID"property="sampl"/>
</h2>
</body>
</html>
...全文
65 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wickson592520 2010-05-14
返回的错误:

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

exception

org.apache.jasper.JasperException: /WebRoot/jspbeanjsp.jsp(7,0) The value for the useBean class attribute www.bag.JspBean1 is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1220)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
org.apache.jasper.compiler.Generator.generate(Generator.java:3416)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
回复
wickson592520 2010-05-14
JspBean1.java代码
public class JspBean1 {
private String sampl="Start value";
public String getSampl()
{return sampl;}


public void setSampl(String newValue){
if(newValue!=null){
sampl=newValue;
}
}
}
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-05-14 10:17
社区公告
暂无公告