随笔 - 117  文章 - 72  trackbacks - 0

声明:原创作品(标有[原]字样)转载时请注明出处,谢谢。

常用链接

常用设置
常用软件
常用命令
 

订阅

订阅

留言簿(7)

随笔分类(130)

随笔档案(123)

搜索

  •  

积分与排名

  • 积分 - 153555
  • 排名 - 389

最新评论

《JSP完全学习手册》学习心得:jsp:forward

Judgment.jsp:
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<html>
<head>
</head>
<body>
<%
  String User=request.getParameter("User");
  String Password=request.getParameter("Password");
  if(User.equals("Admin") && Password.equals("Admin")) { %>
     <jsp:forward page="welcome.jsp"/>
  <% }
  else
  { %>
    <jsp:forward page="Login.html"/>
  <% } %>
</body>
</html>
welcome.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<html>
<head>
<title>Forward动作示例</title>
</head>
<body>
<center><h2>登录成功</h2>
<p>欢迎
<% String User=request.getParameter("User");
 out.print(User);

 %>
</p>
</body>
</html>
Login.jsp:
<html>
<head>
<title>登录信息</title>
</head>
<body>
<form action="Judgment.jsp" method="post" name="Loginfrm" id="Loginfrm">
  <table width="298"  border="0" align="center" cellpadding="2" cellspacing="1">
    <tr>
      <td align="right">用户名:</td>
      <td align="left"><input name="User" type="text"  size="28"></td>
    </tr>
    <tr>
      <td  align="right">密 码:</td>
      <td align="left"><input name="Password" type="password" size="30"></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input type="submit" value="登录">
        &nbsp;
      <input type="reset"  value="取消"></td>
    </tr>
  </table>
</form>
</body>
</html>
posted on 2009-05-27 23:24 天堂露珠 阅读(187) 评论(0)  编辑  收藏 所属分类: JSP

只有注册用户登录后才能发表评论。


网站导航: