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); ...
随机推荐
- Python 3.2: 使用pymysql连接Mysql
在python 3.2 中连接MYSQL的方式有很多种,例如使用mysqldb,pymysql.本文主要介绍使用Pymysql连接MYSQL的步骤 1 安装pymysql · ...
- 用Rufus来制作Windows10的U盘安装盘
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:用Rufus来制作Windows10的U盘安装盘.
- 神经网络学习-问题(二)-scipy未正确安装报DLL找不到的问题
问题如下: E:\project\DL\python\keras>python keras_sample.pyUsing Theano backend.Traceback (most recen ...
- Cloud Computing Deployment Models
Cloud computing can broadly be broken down into three main categories based on the deployment model. ...
- 机器学习笔记之遗传算法(GA)
遗传算法是一种大致基于模拟进化的学习方法,假设常被描述为二进制串.在遗传算法中,每一步都根据给定的适应度评估准则去评估当前的假设,然后用概率的方法选择适应度最高的假设作为产生下一代的种子.产生下一代的 ...
- Weka – 分类
1. weka简单介绍 1) weka是新西兰怀卡托大学WEKA小组用JAVA开发的机器学习/数据挖掘开源软件. 2) 相关资源链接 http://sourceforge.net/pro ...
- ClassLoader使用记录《安卓高手之路》
我不喜欢那些泛泛而谈的去讲那些形而上学的道理,更不喜欢记那些既定的东西.靠记忆去弥补思考的人,容易陷入人云亦云的境地,最后必定被记忆所围困,而最终消亡的是创造力.希望这个高手之路系列能够记录我学习安卓 ...
- python 2.5源代码编绎
VS C++项目中,选择工程项名称,右菜单中选择--->仅适用于项目---->仅生成(项目) 1.make_buildinfo,make_versioninfo make_buildinf ...
- PAT 1004
1004. Counting Leaves (30) A family hierarchy is usually presented by a pedigree tree. Your job is t ...
- visual studio 2013 c++ 打开code map 功能
属性->c++ -> Browse Infomation -> Enable Browse Infomation设为true http://msdn.microsoft.com/li ...