-----------SayHelloBean.html
<html>
<head>
<title>基本数据输出</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
</head>
<div align="center">
<p>请输入您的数据</p>
<form method="post" action="SayHelloBean.jsp">
<p>姓名 <input type="text" name="name">
性别<select name="sex">
<option value="先生">先生</option>
<option value="小姐">小姐</option>
</select></p>
<p>
<input type="submit" name="Submit" value="送出"></p></form>
<p> </p>
<p> </p>
</div>
</body>
</html>-----------------------SayHelloBean.jsp
<%@ page language="java" %>
<%@ page import="Hello.HelloBean" %>
<jsp:useBean id="Test" class="HelloBean" scope="request">
<jsp:setProperty name="Test" property="name"/>
<jsp:setProperty name="Test" property="sex"/>
</jsp:useBean><html>
<head>
<title>HelloBean</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF">
<p> </p>
<p align="center">
<font size="4">Hello
<font color="#0000FF"><b>
<%=Test.getName() %>
</b></font>
<%=Test.getSex() %>
你好! </font></p>
</body>
</html>
package Hello;
public class HelloBean {
private String name="";
private String sex="";
public HelloBean(){
}
public void setName(String name){
this.name= name;
}
public String getName(){
return this.name;
}
public void setSex(String sex){
this.sex= sex;
}
public String getSex(){
return this.sex;
}
}出现如下问题:
Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: /SayHelloBean.jsp(3,0) The value for the useBean class attribute HelloBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
<html>
<head>
<title>基本数据输出</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
</head>
<div align="center">
<p>请输入您的数据</p>
<form method="post" action="SayHelloBean.jsp">
<p>姓名 <input type="text" name="name">
性别<select name="sex">
<option value="先生">先生</option>
<option value="小姐">小姐</option>
</select></p>
<p>
<input type="submit" name="Submit" value="送出"></p></form>
<p> </p>
<p> </p>
</div>
</body>
</html>-----------------------SayHelloBean.jsp
<%@ page language="java" %>
<%@ page import="Hello.HelloBean" %>
<jsp:useBean id="Test" class="HelloBean" scope="request">
<jsp:setProperty name="Test" property="name"/>
<jsp:setProperty name="Test" property="sex"/>
</jsp:useBean><html>
<head>
<title>HelloBean</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF">
<p> </p>
<p align="center">
<font size="4">Hello
<font color="#0000FF"><b>
<%=Test.getName() %>
</b></font>
<%=Test.getSex() %>
你好! </font></p>
</body>
</html>
package Hello;
public class HelloBean {
private String name="";
private String sex="";
public HelloBean(){
}
public void setName(String name){
this.name= name;
}
public String getName(){
return this.name;
}
public void setSex(String sex){
this.sex= sex;
}
public String getSex(){
return this.sex;
}
}出现如下问题:
Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: /SayHelloBean.jsp(3,0) The value for the useBean class attribute HelloBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
解决方案 »
- JSP文件上传问题
- ExtJS
- 非action在哪配置services呢?
- 关于库存警告的问题!
- JavaScript与数据如何关联?
- JAVA实现CSV文件下载错误
- ajax,在jsp中,一般用什么实现?dwr?jquery?还是XMLHttpRequest?
- 在线等,一个在用jsp向数据库中存数据时出现的小问题,各位帮忙看看
- 同一个程序在有的机子上用javaBean连数据库连不上,出现java.lang.NullPointerException错误
- Redhat 10中用jfreechart画图中文问题!
- 求救呀!<a href="/register.html">返回</a>老是出错!
- 高分求助 !~如何根据list从数据库中读取数据?
<jsp:setProperty name="Test" property="sex"/>改成<jsp:setProperty name="Test" param="name"/>
<jsp:setProperty name="Test" param="sex"/>
是不是应该写成:
<jsp:setProperty name="Test" property="name" value ="xxxxx"/>
<jsp:setProperty name="Test" param="sex"/><jsp:setProperty name="Test" property="name"/>
<jsp:setProperty name="Test" property="name" value ="*"/>
这两种方式都可以啊?
<%
Test.setName(request.getParameter("name"));
Test.setSex(request.getParameter("sex"));
%>
就可以了
<jsp:setProperty name="test" property="*"/>使用jsp:useBean时,class要给出bean的全名,包括包。
谢谢啦!关于客户端页面从数据库中读取大量图片的问题
http://community.csdn.net/Expert/TopicView3.asp?id=4816106乱码还原问题!
http://community.csdn.net/Expert/TopicView3.asp?id=4813786关于javabean反射代理的问题
http://community.csdn.net/Expert/TopicView3.asp?id=4813935大家帮忙顶顶!
<%
Test.setName(request.getParameter("name"));
Test.setSex(request.getParameter("sex"));
%>
<jsp:useBean id="Test" class="HelloBean" scope="request">
改成
<jsp:useBean id="Test" class="Hello.HelloBean" scope="request">
就OK了