随笔-0  评论-0  文章-16  trackbacks-0
t5.jsp

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>
<form action="t6.jsp" method=post>
   <ul style="list-style: none; line-height: 30px">
     <li>
   输入用户姓名:
   <input type="text" name="name" />
   <br />
     </li>
    
     <li>
   请选择个人爱好:
   <div style="width: 400px">
    <input name="like" type="checkbox" value="唱歌跳舞" />
    唱歌跳舞
    <input name="like" type="checkbox" value="上网冲浪" />
    上网冲浪
    <input name="like" type="checkbox" value="户外登山" />
    户外登山
    <br />
    <input name="like" type="checkbox" value="体育运动" />
    体育运动
    <input name="like" type="checkbox" value="读书看报" />
    读书看报
    <input name="like" type="checkbox" value="欣赏电影" />
    欣赏电影
   </div>
  </li>
    
     <li>
   <input type="submit" value="提交" />
  </li>
   </ul>
</form>
</body>
</html>

t6.jsp

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>Insert title here</title>
</head>
<body>

<ul style="list-style:none; line-height:30px">
<li>输入用户姓名:<%=new String(request.getParameter("name").getBytes("ISO8859_1"),"GBK") %></li>

<li>
   请选择个人爱好:
   <%
    String[] like =request.getParameterValues("like");
    for(int i =0;i<like.length;i++){
   %>
   <%= new String(like[i].getBytes("ISO8859_1"),"GBK")+"&nbsp;&nbsp;" %>
   <%
    }
   %>
  </li>
  
</ul>

</body>
</html>






posted on 2012-07-04 13:18 jhtchina 阅读(122) 评论(0)  编辑  收藏 所属分类: jsp初学