为什么这段JavaBean的程序会出错?在MyEclipse10里没有体现任何异常。答案
为什么这段JavaBean的程序会出错?在MyEclipse10里没有体现任何错误。在线等答案。
test.jsp源代码:
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%request.setCharacterEncoding("GBK");%>
<jsp:useBean id="student" class="ch04.Student" scope="session" />
<jsp:setProperty name="student" property="*"/>
<jsp:setproperty name="student" property="age" value="30"/>
<html>
<head>
<title>我的第一个JAVA程序</title>
<meta http-equiv="Content-Type" content="text/html;charset=GBK">
</head>
<body>
<%if(student.getQuery()){%>
<h2>查询结果:</h2><br>
姓名:<jsp:getProperty name="student" property="name"/><br>
学号:<jsp:getProperty name="student" property="stuCode"/><br>
年龄:<jsp:getProperty name="student" property="age"/><br>
<%}%>
<hr>
<h2>学生</h2>
<form name="javabean" action="test.jsp" method="get">
<input type=hidden name="query" value="true">
<p>姓名:<input type="text" name="name"></p>
<p>学号:<input type="text" name="stuCode"></p>
<p>
<input type="submit" value="提交">
<input type="reset" value="取消">
</p>
</form>
ch04.Student类的源代码:
package ch04;
public class Student {
public String name;
public String stuCode;
public int age;
private boolean query;
public Student(){
name="xiaojianye";
stuCode="bbb";
age=30;
query=false;
}
public void setName(String name){
this.name=name;
}
public void setStuCode(String stuCode){
this.stuCode=stuCode;
}
public void setAge(int age){
this.age=age;
}
public void setQuery(boolean query){
this.query=query;
}
public String getName(){
return name;
}
public String getStuCode(){
return stuCode;
}
public int getAge(){
return age;
}
public boolean getQuery(){
return query;
}
}
</body>
</html>
出错信息:见附件
部署界面:见附件
------解决方案--------------------
<jsp:setproperty
p小写了。应该大写。
------解决方案--------------------
找不到服务?
------解决方案--------------------
很多早的帖子 。
------解决方案--------------------
自己解决了。谢谢!
test.jsp源代码:
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%request.setCharacterEncoding("GBK");%>
<jsp:useBean id="student" class="ch04.Student" scope="session" />
<jsp:setProperty name="student" property="*"/>
<jsp:setproperty name="student" property="age" value="30"/>
<html>
<head>
<title>我的第一个JAVA程序</title>
<meta http-equiv="Content-Type" content="text/html;charset=GBK">
</head>
<body>
<%if(student.getQuery()){%>
<h2>查询结果:</h2><br>
姓名:<jsp:getProperty name="student" property="name"/><br>
学号:<jsp:getProperty name="student" property="stuCode"/><br>
年龄:<jsp:getProperty name="student" property="age"/><br>
<%}%>
<hr>
<h2>学生</h2>
<form name="javabean" action="test.jsp" method="get">
<input type=hidden name="query" value="true">
<p>姓名:<input type="text" name="name"></p>
<p>学号:<input type="text" name="stuCode"></p>
<p>
<input type="submit" value="提交">
<input type="reset" value="取消">
</p>
</form>
ch04.Student类的源代码:
package ch04;
public class Student {
public String name;
public String stuCode;
public int age;
private boolean query;
public Student(){
name="xiaojianye";
stuCode="bbb";
age=30;
query=false;
}
public void setName(String name){
this.name=name;
}
public void setStuCode(String stuCode){
this.stuCode=stuCode;
}
public void setAge(int age){
this.age=age;
}
public void setQuery(boolean query){
this.query=query;
}
public String getName(){
return name;
}
public String getStuCode(){
return stuCode;
}
public int getAge(){
return age;
}
public boolean getQuery(){
return query;
}
}
</body>
</html>
出错信息:见附件
部署界面:见附件
------解决方案--------------------
<jsp:setproperty
p小写了。应该大写。
------解决方案--------------------
找不到服务?
------解决方案--------------------
很多早的帖子 。
------解决方案--------------------
自己解决了。谢谢!