码迷,mamicode.com
首页 > Web开发 > 详细

实现简单的网页间的跳转

时间:2017-09-30 19:43:42      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:org   use   pos   logs   cte   bsp   失败   port   技术   

 

技术分享

 

技术分享

技术分享

 

 

代码:

login.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>


<body>

<br/>

<center>

<form action="check.jsp" method="post">
<input type="text" name="userName"><br>
<input type="password" name="password"><br>
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>

</center>
</body>
</html>

 

check.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<html>


<body>
<%
request.setCharacterEncoding("utf-8");
String str1 = request.getParameter("userName");
String str2 = request.getParameter("password");

if( str1.equals("aaa") && str2.equals("aaa") ){
%>

<jsp:forward page="success.jsp"></jsp:forward>

<%
}else{
%>

<jsp:forward page="fail.jsp"></jsp:forward>
<%} %>

</body>
</html>

 

 success.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<body>

<center>
<% String str1 = request.getParameter("userName"); %>
<% String str2 = request.getParameter("password"); %>

<h3><%=str1 %>!!! </h3>
<h3><%=str2 %></h3>
<h1>you are welcome!</h1>
</center>
</body>
</html>

 

 

fail.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html>

<body>
<center>

<h1>登陆失败</h1><br>
<h1> <a href="login.jsp">请重新登陆</a> </h1>

</center>
</body>
</html>

实现简单的网页间的跳转

标签:org   use   pos   logs   cte   bsp   失败   port   技术   

原文地址:http://www.cnblogs.com/qq1206050421/p/7615762.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!