JSP基础实例_列表框交互_学习笔记

JSP基础实例_列表框交互_学习笔记_第1张图片

Register.html

<p><strong>注册用户</strong></p>

<form action="Register.jsp" method="post"> 

<table width="300" border="1">

<tr>

<td>账号:</td>

<td><input name="account" type="text"/></td>

</tr>

<tr>

<td>密码:</td>

<td><input name="password" type="password"/></td>

</tr>

<tr>

<td>爱好</td>

<td>

<select name="love" size="3">

<option value="football" selected="selected">足球</option>

<option value="basketball">篮球</option>

<option value="swimming">游泳</option>

<option value="shopping">购物</option>

<option value="movie">看电影</option>

</select>

</td>

</tr>

<tr>

<td colspan="2"><center>

<input type="reset" value="重置"/>

<input type="submit" value="提交"/></center>

</td>

</tr>

</table>

</form>


Register.jsp

<%

String account = request.getParameter("account");

String password = request.getParameter("password");

String love = request.getParameter("love");

if( !account.equals("") && !password.equals(""))

{

%>

<center><strong><%=account %>同学</strong><br/>欢迎您加入我们,你的爱好是<%=love %></center>

<%

}else{

%>

<center><strong>对不起</strong><br/>请先完成注册信息!</center>

<%

}

%>

你可能感兴趣的:(JSP基础实例_列表框交互_学习笔记)