JSP之session
index.jsp:
<form id="form1" name="form1" method="post" action="session.jsp">
<table width="500" border="0" height="54">
<tr>
<td><div align="center">您的名字是:</div></td>
<td><label>
<input type="text" name="name" />
</div>
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
</tr>
</table>
<label></label>
</form>
session.jsp:
<%
String name=request.getParameter("name");
//获取用户填写的用户名
session.setAttribute("name", name);
//将用户名保存到session对象中
%>
<form id="form1" name="form1" method="post" action="MyJsp.jsp">
<table width="500" border="0">
<tr>
<td>您的名字是:</td>
<td><form id="form3" name="form3" method="post">
<label>
<td>
<%=name %></td>
</label>
</form>
</td>
</tr>
<tr>
<td><div align="center">您的想要去的地方是:</div></td>
<td><label>
<input type="text" name="address" />
</div>
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<input type="submit" name="Submit" value="提交" />
</label></td>
</tr>
</table>
<label></label>
</form>
MyJsp.jsp:
<%
String name=session.getAttribute("name").toString();
String address=request.getParameter("address");
%>
<form id="form1" name="form1" method="post" action="">
<table width="500" border="0">
<tr>
<td colspan="2"><div align="center">SHOW</div></td>
</tr>
<tr>
<td>你的名字是:</td>
<td><%=name %></td>
<tr>
<td><div align="center">您的想要去的地方是:</div></td>
<td><%=address %></td>
</tr>
</table>
</form>
JSP之session的更多相关文章
- jsp之session对象
jsp之session对象:一:概念session对象可以在应用程序的web页面之间跳转时保存用户的信息,使整个用户会话一直存在,直到关闭浏览器或是销毁session.session的生命周期:20~ ...
- JSP(5)—Session的创建以及简单使用
页面: 1.案例 <body> <!-- 把书的信息以Cookie方式传回给浏览器,删除一个Cookie 1.确定要被删除的Cookie是以ATGUIGU_BOOK_开头的cooki ...
- JS或jsp获取Session中保存的值
JS是不能读取Session中的值的 . session是服务器对象, javascript是客户端脚本,你能做的操作就是把这个值用 <%=%>输出到页面的javascript中参与运算, ...
- jsp通过session传递checkbox中的值
获取checkbox中的值(第一个页面) <% String foodName[]=request.getParameterValues("chioce"); //“chio ...
- 【JSP手记】--jsp里面session.getAttribute("×××")在java中的表示
JSP里面的 <%=session.getAttribute("×××")%> 与java等价于 request.getSession().get ...
- JSP中Session的使用
JSP session使用方法 <%@page contentType="text/html;charset=GB2312"%><html> <he ...
- jsp判断session中的值
方法有两种: 假设,此session的名字叫adminAccount 1.EL表达式 <script type="text/javascript"> if($.trim ...
- 购物车的实现(jsp的session+Java的Map的结合)
1:电商如此发达的现在,作为一个web开发程序猿,如果不会写购物车,真是有点不好意思找工作.所以抓紧练习啊,从上篇博客中抽离出如何实现购物车的功能. 2:首先需要理解购物车实现的一些基本步骤. 2.1 ...
- Jsp和session、request.getSession()
request.getSession(false); 这段代码代表,如果没有和当前request关联的session则不创建session并且返回空 request.getSession(true); ...
随机推荐
- iOS 通知中心 NSNotificationCenter
iOS开发中,每个app都有一个通知中心,通知中心可以发送和接收通知. 在使用通知中心 NSNotificationCenter之前,先了解一下通知 NSNotification. NSNotific ...
- Nexus搭建Manven
Nexus相当于中转服务器,减轻网络的负载,加速项目搭建的进程 1.下载地址:http://www.sonatype.org/nexus/go 2.下载的是zip包,解压后进入D:\nexus-2.8 ...
- CGContext绘图
0 CGContextRef context = UIGraphicsGetCurrentContext(); 设置上下文 1 CGContextMoveToPoint 开始画线 2 CGContex ...
- iOS Foundation 框架概述文档:常量、数据类型、框架、函数、公布声明
iOS Foundation 框架概述文档:常量.数据类型.框架.函数.公布声明 太阳火神的漂亮人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业 ...
- C#类索引器的使用
索引器提供了一种可以让类被当作数组进行访问的方式.在C#中,类索引器是通过this的属性实现的.index.ToString("D2")将index转换成一个具有两个字符宽度的字符 ...
- 【Objective-C】04-第一个OC程序解析
说明:这个Objective-C专题,是学习iOS开发的前奏.也为了让有面向对象语言开发经验的程序猿,可以高速上手Objective-C.假设你还没有编程经验,或者对Objective-C.iOS开发 ...
- [AngularJS] ngModelController render function
ModelValue and ViewValue: $viewValue: Actual string value in the view. $modelValue: The value in the ...
- restful php
http://bbs.phpchina.com/thread-228725-1-1.html http://www.cnblogs.com/artech/p/3506553.html http://w ...
- c语言数组的初始化
#include "stdio.h" int main() { ][]; a[][]="1,2,3,4,5,6,7,8,9,10,11,12"; ]=a,*p= ...
- T-SQL 之 概述
T-SQL(Transact Structured Query Language )它是ANSI和ISO SQL 标准的Microsoft SQL Server方言或扩展,SQL SERVER专用标准 ...