Struts2--带参数的结果集
带参数的结果集:
配置文件: <result type="redirect">/user_success.jsp?t=${type}</result>
jsp调用 :
from valuestack: <s:property value="t"/><br/> //取不到,因为客户端跳转后 以前action的值都没有了.
from actioncontext: <s:property value="#parameters.t"/>
1. jsp显示文件:]
<ol>
<li><a href="user/user?type=1">传参数</a></li>
</ol>
2. struts.xml配置文件:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"> <struts>
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/user" extends="struts-default"> <action name="user" class="com.bjsxt.struts2.user.action.UserAction">
<result type="redirect">/user_success.jsp?t=${type}</result>
</action>
</package>
</struts>
3. action文件:
package com.bjsxt.struts2.user.action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
private int type;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
@Override
public String execute() throws Exception {
return "success";
}
}
4. user_success.jsp:
<body>
User Success!
from valuestack: <s:property value="t"/><br/> 取不出来, 因为客户端跳转, 值栈已清空
from actioncontext: <s:property value="#parameters.t"/>
<s:debug></s:debug>
</body>
Struts2--带参数的结果集的更多相关文章
- 01_15_Struts2_带参数的结果集
01_15_Struts2_带参数的结果集 1. 背景说明 服务器端页面跳转的时候,通过struts提供的标签的valuestack可以直接取.服务器端的转发,valuestack的对象属性可以共享. ...
- Struts2中带参数的结果集
2.首先,新建一个struts2项目,项目名为ResultParam,打开index.jsp页面,修改编码格式为utf-8,添加一个超链接,用于向结果集传参数,完整代码如下: 相应的struts.xm ...
- struts result动态结果集 带参数的结果集
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC &qu ...
- Struts2_带参数的结果集
页面请求: <a href="user/user?type=1">传参数</a> action: public Integer type; public S ...
- 全局结果集,带参数的结果集和动态结果集(struts2)
全局结果集: 当许多action都有共同的结果时,如果每个package都存在一个相同结果,会使得struts.xml比较臃肿,所以使用全局的结果集.一个包内的全局结果集可以通过包的继承而被其它包使用 ...
- Struts2 动态结果和带参数的跳转
完整代码:Struts16ActionResultsDemo.rar 1.动态结果. 有时我们需要在Action里取得我个要转跳的页面 看一下我们的struts.xml <?xml versio ...
- Oracle游标--cursor_01-简单不带参数实现功能
对于游标这个概念,可以理解为类似我们以前学习的jdbc的结果集对象, 我们可以使用游标对结果集从上到下进行遍历,获取每一行内容 首先我们要分析一下游标的分类 带参数的 书写函数的整体架构 定义游标 开 ...
- Struts 2.3.24源码解析+Struts2拦截参数,处理请求,返回到前台过程详析
Struts2官网:http://struts.apache.org/ 目前最新版本:Struts 2.3.24 Struts1已经完全被淘汰了,而Struts2是借鉴了webwork的设计理念而设计 ...
- SSRS 系列 - 使用带参数的 MDX 查询实现一个分组聚合功能的报表
SSRS 系列 - 使用带参数的 MDX 查询实现一个分组聚合功能的报表 SSRS 系列 - 使用带参数的 MDX 查询实现一个分组聚合功能的报表 2013-10-09 23:09 by BI Wor ...
随机推荐
- http response
关键词:http response header 下载文件 案例1: 访问某个链接,然后下载文件,需要特定的http头: header("Content-Type:application/z ...
- 我的C笔记
最近更新: 1,父进程fork一个子进程,当向父进程发送一个SIGINT或其它信号时,子进程是否会接受到该信号? 2,父进程调用system执行一个程序时,向父进程发送一个信号时,system运行中的 ...
- python http请求
from httplib2 import Http def postDada(): http=Http() heads={"pragma":"no-cache" ...
- 笨方法学python--第一个程序
该章主要知识点有: 1 print 打印,有双引号,单引号 2 分析报错信息,积累经验 3 # -*- coding:utf-8 -*-,可以输出汉字 4 井号,# ,注释, 英文名 octothor ...
- UML示例图
- linux 内核协议栈收报流程(一)ixgbe网卡驱动
首先模块加载insmod ixgbe.ko module_init(ixgbe_init_module); module_init(ixgbe_init_module); { int ret; pr_ ...
- sql查询百分号的方法
select * from [tablename] where [col] like '%100/%%' escape '/'
- mysql 连接两列
以下划线符号,连接两列,作为查询结果: SELECT CONCAT(col_1,'_',col_2) FROM yourtable
- sql server中单引号拼接字符串(书写错误会出现错误"浮点值 XXXX 超出了计算机表示范围(8 个字节)。“XX”附近有语法错误。")
" ' "(单引号)的运用:在sql server中,两个" ' "(单引号)在拼接字符串的情况下运用,就是表示拼接上了一个" ' "单引号 ...
- 关于web.xml的格式
先是filter 再是<filter-mapping> 然后<servlet> 再是<servlet-mapping> 这是一种规范基于j2ee 在开发的过程中一 ...