| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 718 人关注过本帖
标题:JavaBean的问题
取消只看楼主 加入收藏
lihuifeng
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-8-23
收藏
 问题点数:0 回复次数:1 
JavaBean的问题

JavaBean类UserBean.java

public class UserBean {
private String Name;
private String Num;

public UserBean() {

}
public void setUserName(String name){
Name=name;
}
public void setUserNum(String num){
Num=num;
}

public String getUserName() {
return Name;
}


public String getUserNum() {
return Num;

}
}
把编译好的JavaBean程序 放置在“web-inf/classes”目录中
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*" errorPage="" %>
<%
request.setCharacterEncoding("GBK");
%>
<html>
<head>
<title>javaBean的使用</title>
</head>

<body>
<jsp:useBean id="dada" scope="session" class="UserBean"/>
<jsp:setProperty name="dada" property="userName" param="name"/>
<jsp:setProperty name="dada" property="userNum" param="do"/>
<table width="40%" border="1">
<tr>
<td width="30%">
姓名:
</td>
<td width="70%">
<jsp:getProperty name="dada" property="UserName"/>
</td>
</tr>
<tr>
<td>
职业:
</td>
<td>
<jsp:getProperty name="dada" property="UserNum"/>
</td>
</tr>
</table>
</body>
</html>
打开时这个页面出现
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

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

exception

org.apache.jasper.JasperException: /4-1.jsp(11,0) The value for the useBean class attribute UserBean 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:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.9
这是怎么回事啊 ? 希望帮我解决一下 谢谢~

搜索更多相关主题的帖子: JavaBean String public Num UserBean 
2006-11-04 09:58
lihuifeng
Rank: 1
等 级:新手上路
帖 子:37
专家分:0
注 册:2006-8-23
收藏
得分:0 

怎么没人理我啊

2006-11-04 12:40
快速回复:JavaBean的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019413 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved