getInfo,jsp
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'getInfo.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String username=request.getParameter("username");
String password=request.getParameter("password");
String sex=request.getParameter("sex");
String country=request.getParameter("country");
String lan[]=request.getParameterValues("language");
String favorite[]=request.getParameterValues("favorite");
out.print("用户名:"+username+"<br>");
out.print("密码:"+password+"<br>");
out.print("性别:"+sex+"<br>");
out.print("国籍:"+country+"<br>");
%>
语言:
<%for(int i=0;i<lan.length;i++){
out.print(lan[i]+" ");
}
%>
<br>
爱好:
<%
if(favorite==null)
{
out.print("累感不爱");
}
else
{
for(int i=0;i<favorite.length;i++){
out.print(favorite[i]+" ");
}
}
%>
<table align="center" border=1>
<tr><td width=150>项目</td><td width=450>信息</td></tr>
<tr><td>姓名</td><td><%=username %></td></tr>
<tr><td>密码</td><td><%=password %></td></tr>
<tr><td>性别</td><td><%=sex %></td></tr>
<tr><td>国籍</td><td><%=country %></td></tr>
<tr><td rowspan=<%=lan.length%>> 语言</td>
<td> <%=lan[0]%></td> </tr>
<%for(int i=1;i<lan.length;i++){%>
<tr><td> <%=lan[i]%></td></tr>
<%
} %>
<%
if(favorite==null)
{%>
<tr><td rowspan=1>爱好</td>
<td> 无</td> </tr>
<%
}
else
{%>
<tr><td rowspan=<%=favorite.length%>>爱好</td>
<td> <%=favorite[0]%></td> </tr>
<%
for(int i=1;i<favorite.length;i++){
%>
<tr><td> <%=favorite[i]%></td></tr>
<%
}
}%>
</table>
<br>
</body>
</html>
myInfo.html
<!DOCTYPE html>
<html>
<head>
<title>myInfo.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<style type="text/css">
body
{
font-size:12px;
}
.center
{
margin:0 auto;
width:600px;
background:lightblue;
padding:10px 50px ;
}
.title
{
font-size:20px;
color:blue;
font-weight:bold;
text-align:center;
}
</style>
</head>
<body>
<div class="center">
<form method="post" action="getInfo.jsp">
<p class="title">个人信息</p>
<p>用户名:<input type="text" name="username"></p>
<p>密 码:<input type="password" name="password"></p>
<p>性别:<input type="radio" name="sex" value="男" checked>男
<input type="radio" name="sex" value="女">女</p>
<p>国籍:<select name="country" style="width:100px;">
<option value="中国" selected>中国</option>
<option value="台湾">台湾</option>
<option value="日本">日本</option>
<option value="美国">美国</option>
<option value="其他">其他</option>
</select></p>
<p>语言:<br><select name="language" size=5 multiple style="width:100px;">
<option value="汉语" selected>汉语</option>
<option value="英语" selected>英语</option>
<option value="法语">法语</option>
<option value="西班牙语">西班牙语</option>
<option value="其他">其他</option>
</select></p>
<p> 爱好:<br>
<input type="checkbox" name=favorite value="电脑">电脑
<input type="checkbox" name=favorite value="学习">学习
<input type="checkbox" name=favorite value="体育">体育
<input type="checkbox" name=favorite value="其他">其他 </p>
<p>个人简介:<br>
<textarea name="text" rows=6 cols=80>
</textarea></p>
<p align="center"><input type="submit" value="注册"></p>
</form>
</div>
</body>
</html>

本文详细探讨了在MyEclipse中如何进行JSP页面间的跳转,包括使用getInfo方法和其他常见方法,旨在帮助开发者更好地理解和操作jsp页面的跳转流程。

447

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



