73 forward动作

简介: 73 forward动作

定义一个logind的jsp页面

<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="ISO-8859-1">
 <title>Insert title here</title>
 </head>
 <body>
 <h1>用户登录</h1>
 <hr>
 <form action="forward.jsp" name="loginForm" method="post">
 <table>
 <tr>
 <td>用户名:</td>
 <td><input type="text" name="username"/></td>
 </tr>
 <tr>
 <td>密码:</td>
 <td><input type="password" name="password"/></td>
 </tr>
 <tr>
 <td colspan="2"><input type="submit" value="登录"></td>
 </tr>
 </table>
 </body>
 </html> <%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="utf-8">
 <meta http-equiv="pragma" content="no-cache">
 <title>Insert title here</title>
 </head>
 <body>
 <h1>forward 动作</h1>
 <jsp:forward page="user.jsp"/>
 </body>
 </html><%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
 <!DOCTYPE html>
 <html>
 <head>
 <meta charset="ISO-8859-1">
 <title>Insert title here</title>
 </head>
 <body>
 <h1>用户资料</h1>
 <%
 String username="";
 String password = "";
 if(request.getParameter("username")!=null){
     username = request.getParameter("username");
 }
 if(request.getParameter("password")!=null){
     username = request.getParameter("password");
 }
 %>
 用户名:<%=username %>
 密码:<%=password %>>
 </body>
 </html>

image.png

相关文章
|
1月前
|
SQL 自然语言处理
decode是个什么动作?
【2月更文挑战第14天】decode是个什么动作?
14 2
|
2天前
|
Java
Forward与redirect的区别
总结:Forward适合在同一个应用内部进行页面跳转和数据共享,效率高;Redirect适合在不同应用间或需要完全不同上下文的页面跳转,涉及两次请求,URL地址会改变。选择使用哪种方式取决于具体的需求和场景。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
5 0
|
1月前
|
机器学习/深度学习
前向扩散过程(Forward Process)
前向扩散过程(Forward Process)
29 6
|
5月前
forward内部跳转 和redirect重定向跳转的区别
forward内部跳转 和redirect重定向跳转的区别
|
8月前
执行阿里云RPA中的相同动作
执行阿里云RPA中的相同动作
96 1
|
测试技术 内存技术 Python
|
网络协议 关系型数据库