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的更多相关文章

  1. jsp之session对象

    jsp之session对象:一:概念session对象可以在应用程序的web页面之间跳转时保存用户的信息,使整个用户会话一直存在,直到关闭浏览器或是销毁session.session的生命周期:20~ ...

  2. JSP(5)—Session的创建以及简单使用

    页面: 1.案例 <body> <!-- 把书的信息以Cookie方式传回给浏览器,删除一个Cookie 1.确定要被删除的Cookie是以ATGUIGU_BOOK_开头的cooki ...

  3. JS或jsp获取Session中保存的值

    JS是不能读取Session中的值的 . session是服务器对象, javascript是客户端脚本,你能做的操作就是把这个值用 <%=%>输出到页面的javascript中参与运算, ...

  4. jsp通过session传递checkbox中的值

    获取checkbox中的值(第一个页面) <% String foodName[]=request.getParameterValues("chioce"); //“chio ...

  5. 【JSP手记】--jsp里面session.getAttribute("×××")在java中的表示

    JSP里面的    <%=session.getAttribute("×××")%> 与java等价于         request.getSession().get ...

  6. JSP中Session的使用

    JSP session使用方法 <%@page contentType="text/html;charset=GB2312"%><html>  <he ...

  7. jsp判断session中的值

    方法有两种: 假设,此session的名字叫adminAccount 1.EL表达式 <script type="text/javascript"> if($.trim ...

  8. 购物车的实现(jsp的session+Java的Map的结合)

    1:电商如此发达的现在,作为一个web开发程序猿,如果不会写购物车,真是有点不好意思找工作.所以抓紧练习啊,从上篇博客中抽离出如何实现购物车的功能. 2:首先需要理解购物车实现的一些基本步骤. 2.1 ...

  9. Jsp和session、request.getSession()

    request.getSession(false); 这段代码代表,如果没有和当前request关联的session则不创建session并且返回空 request.getSession(true); ...

随机推荐

  1. Linux学习笔记--(1)

    今天用Linux 的 test 命令,发现了一个有趣的现象: 打入 " test "abc"="abc" ;echo $? " 后,结果应该 ...

  2. HTML输出 二 控制行背景颜色

    $Infors = Get-Content ports01.txt$Temp_PortStatustxt = "C:\Windows\Temp\PortStatustxt.txt" ...

  3. 【Android应用开发】 OpenGL ES -- 透视投影 和 正交投影

    博客地址 : http://blog.csdn.net/shulianghan/article/details/46680803 源代码下载 : http://download.csdn.net/de ...

  4. 【WinForm】使用NSIS发布程序

    简介 NSIS(Nullsoft Scriptable Install System)是一个开源的 Windows 系统下安装程序制作程序.它提供了安装.卸载.系统设置.文件解压缩等功能 使用 以下是 ...

  5. 【WinForm】C# 发送Email

    发送Email  的条件 1.SmtpClient SMTP 协议    即 Host 处理事务的主机或IP地址     //smtp.163.com      UseDefaultCredentia ...

  6. Codeforces Round #326 (Div. 2) A. Duff and Meat 水题

    A. Duff and Meat Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/probl ...

  7. 第八讲:HTML5中canvas实现小球击打小方块游戏

    源码:http://download.csdn.net/detail/liumingm900913/7469969 游戏开发流程: 1.创建画布: 将画布放在div标签里面,这样能够控制画布居中的位置 ...

  8. Android开发之初识Camera图像采集

    /* * Android开发之初识camera图像采集 * 北京Android俱乐部群:167839253 * Created on: 2011-8-24 * Author: blueeagle * ...

  9. [Angular 2] Directive intro and exportAs

    First, What is directive, what is the difference between component and directive. For my understandi ...

  10. Xcode8中Swift3.0适配问题

    写在前面 收到一些小伙伴的来信,觉得可能下边没有表达清楚,先把大家关心的要点在此进行总结,有兴趣的可以看看下边的研究过程,没兴趣的直接看这段即可. Xcode8支持Swift2.3和Swift3.0两 ...