jsp setProperty,getProperty,useBean
<!--register.jsp--><%@pagecontentType="text/html;charset=gb2312"%><html><head><title>...
<!--register.jsp-->
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>注册页面</title>
</head>
<body>
<form method=post action=show.jsp>
<center>
<h1 >用户注册</h1>
<table>
<tr>
<td width="65">用户名:</td>
<td width="208"><input type=text name=name></td>
</tr>
<tr>
<td>密码:</td>
<td><input type=password name=password></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input type=email name=email></td>
</tr>
<tr>
<td>年龄:</td>
<td><input type=age name=age></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><p>
<input name="submit" type=submit value="提交">
<input type=reset value="重置">
</p>
</td>
</tr>
</table>
</center>
</body>
</html>
<!--show.jsp文件代码-->
<%@ page contentType="text/html";charset="gb2312" %>
<%
request.setCharacterEncoding("gb2312");
%>
<html>
<jsp:useBean id="show" scope="page" class="myBean1.Register"/>
<jsp:setProperty name="show" property="*"/>
<body>
<br>
<table>
<tr>
<p>
用户名:<jsp:getProperty name="show" property="name" />
<br>
密码:<jsp:getProperty name="show" property="password" />
<br>
邮箱:<jsp:getProperty name="show" property="email" />
<br>
年龄:<jsp:getProperty name="show" property="age" />
</tr>
</table>
</body>
</html>
package myBean1;
public class Register{
public String name;
public String password;
public String email;
public String age;
public void setName(String name)
{ this.name=name;}
public void setPassword(String password)
{ this.password=password;}
public void setEmail(String email)
{ this.email=email; }
public void setAge(String age)
{ this.age=age; }
public String getName(){ return this.name;}
public String getPassword(){ return this.password;}
public String getEmail(){ return this.email;}
public String getAge(){ return this.age;}
}
请高手帮忙看看,错在哪里,先谢谢了! 展开
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>注册页面</title>
</head>
<body>
<form method=post action=show.jsp>
<center>
<h1 >用户注册</h1>
<table>
<tr>
<td width="65">用户名:</td>
<td width="208"><input type=text name=name></td>
</tr>
<tr>
<td>密码:</td>
<td><input type=password name=password></td>
</tr>
<tr>
<td>邮箱:</td>
<td><input type=email name=email></td>
</tr>
<tr>
<td>年龄:</td>
<td><input type=age name=age></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"><p>
<input name="submit" type=submit value="提交">
<input type=reset value="重置">
</p>
</td>
</tr>
</table>
</center>
</body>
</html>
<!--show.jsp文件代码-->
<%@ page contentType="text/html";charset="gb2312" %>
<%
request.setCharacterEncoding("gb2312");
%>
<html>
<jsp:useBean id="show" scope="page" class="myBean1.Register"/>
<jsp:setProperty name="show" property="*"/>
<body>
<br>
<table>
<tr>
<p>
用户名:<jsp:getProperty name="show" property="name" />
<br>
密码:<jsp:getProperty name="show" property="password" />
<br>
邮箱:<jsp:getProperty name="show" property="email" />
<br>
年龄:<jsp:getProperty name="show" property="age" />
</tr>
</table>
</body>
</html>
package myBean1;
public class Register{
public String name;
public String password;
public String email;
public String age;
public void setName(String name)
{ this.name=name;}
public void setPassword(String password)
{ this.password=password;}
public void setEmail(String email)
{ this.email=email; }
public void setAge(String age)
{ this.age=age; }
public String getName(){ return this.name;}
public String getPassword(){ return this.password;}
public String getEmail(){ return this.email;}
public String getAge(){ return this.age;}
}
请高手帮忙看看,错在哪里,先谢谢了! 展开
展开全部
show.jsp文件
里要加有<%@ import ="myBean1.Register"%>
用户名:<jsp:getProperty name="show" property="name" />
<br>
密码:<jsp:getProperty name="show" property="password" />
<br>
邮箱:<jsp:getProperty name="show" property="email" />
<br>
年龄:<jsp:getProperty name="show" property="age" />
这段不是这样写的
里要加有<%@ import ="myBean1.Register"%>
用户名:<jsp:getProperty name="show" property="name" />
<br>
密码:<jsp:getProperty name="show" property="password" />
<br>
邮箱:<jsp:getProperty name="show" property="email" />
<br>
年龄:<jsp:getProperty name="show" property="age" />
这段不是这样写的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询