在html界面
<li>
<label style="background-color:#EEEEEE"></label>
<input type="checkbox" value="teacher" id="checkbox1" name="checkbox" style="float: left;vertical-align:middle;" onclick="mini('教师')">
<span class="text" style="float: left;margin-left:5px;margin-top:-10px;">教师</span>
<input type="checkbox" value="admin" id="checkbox2" name="checkbox" style="float: left;vertical-align:middle;" onclick="mini('管理员')">
<span class="text" style="float: left;margin-left:5px;margin-top:-10px;">管理员</span>
<div id="show_text"> </div>
</li>

因为在前端的选中情况会放到request中,所以 在后台把request中的数据读出来即可,如下图:
String [] login=request.getParameterValues("checkbox");
if(login[0].equals("teacher"))
{
System.out.println("教师登录");
}else if(login[0].equals("admin")){
System.out.println("管理员登录");
}

博客提到在HTML界面,前端选中情况会存于request中,后台只需将request里的数据读出。主要涉及前后端的数据交互操作。
1397

被折叠的 条评论
为什么被折叠?



