创建第一个JSP Web应用程序遇到的问题 30
新建Web项目取名为“hello”创建javabean为UserBean代码如下:packageuser;publicclassUserBean{privateStrin...
新建Web项目取名为“hello”
创建javabean为UserBean 代码如下:
package user;
public class UserBean {
private String username;
private String password;
public void setUsername(String username) {
this.username=username;
}
public void setPassword(String password) {
this.password=password;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}
创建的JSP页面:
1.login.jsp 代码如下:
<html >
<body >
<center >
<form method=post action="/hello/display.jsp" >
username <input type=text name=username >
<br > <br >
password <input type=password name=password >
<br > <br >
<input type=submit value="submit" >
</form >
</center >
</body >
</html >
2.display.jsp 代码如下:
<html >
<body >
<jsp:useBean id="hello" class="user.UserBean" scope="session"/ >
<jsp:setProperty name="hello" prorerty="*" >
<%
out.println("hello,");
% >
<jsp:getProperty name="hello" property="uesrname"/ >
<br > <br >
your password is: <jsp:getProperty name="hello" property="password"/ >
<br > <br >
</body >
</html >
遇到的问题:
在Eclipse包视图中右击【login.jsp】 选择【Run As】--【Run on server】命令,在Eclipse代码
窗口中出现了login.jsp显示效果,但紧接着任意输入用户名和密码,单击【submit】按钮,却再没有显示display.jsp的显示效果:
出现了如下信息:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /display.jsp(11,0) SetProperty: Mandatory attribute property missing
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
...........
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
这究竟是怎么一回事啊???????? 展开
创建javabean为UserBean 代码如下:
package user;
public class UserBean {
private String username;
private String password;
public void setUsername(String username) {
this.username=username;
}
public void setPassword(String password) {
this.password=password;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
}
创建的JSP页面:
1.login.jsp 代码如下:
<html >
<body >
<center >
<form method=post action="/hello/display.jsp" >
username <input type=text name=username >
<br > <br >
password <input type=password name=password >
<br > <br >
<input type=submit value="submit" >
</form >
</center >
</body >
</html >
2.display.jsp 代码如下:
<html >
<body >
<jsp:useBean id="hello" class="user.UserBean" scope="session"/ >
<jsp:setProperty name="hello" prorerty="*" >
<%
out.println("hello,");
% >
<jsp:getProperty name="hello" property="uesrname"/ >
<br > <br >
your password is: <jsp:getProperty name="hello" property="password"/ >
<br > <br >
</body >
</html >
遇到的问题:
在Eclipse包视图中右击【login.jsp】 选择【Run As】--【Run on server】命令,在Eclipse代码
窗口中出现了login.jsp显示效果,但紧接着任意输入用户名和密码,单击【submit】按钮,却再没有显示display.jsp的显示效果:
出现了如下信息:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /display.jsp(11,0) SetProperty: Mandatory attribute property missing
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
...........
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
这究竟是怎么一回事啊???????? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询