zoukankan      html  css  js  c++  java
  • 01_15_Struts2_带参数的结果集

    01_15_Struts2_带参数的结果集

    1. 背景说明

    服务器端页面跳转的时候,通过struts提供的标签的valuestack可以直接取。服务器端的转发,valuestack的对象属性可以共享。

    客户端的重定向,如果后续的重定向的是jsp页面,valuestack里的对象不能共享,只能通过applicationcontext来取值。

    2. 配置文件

    struts.xml

    <package name="user" namespace="/user" extends="struts-default">

    <action name="user" class="com.sumapay.user.UserAction">

    <result type="redirect">

    /user_add_success.jsp?t=${type}

                </result>

    </action>

    </package>

    3. action

    public class UserAction extends ActionSupport  {

    @Override

    public String execute() throws Exception {

    return "success";

    }

    String type;

    public String getType() {

    return type;

    }

    public void setType(String type) {

    this.type = type;

    }

    }

    4. jsp页面

    index.jsp

    <body>

        向结果传参数<ul><li><a href="user/user?type=1">传参数</a></li></ul>

    </body>

    user_add_success.jsp

      <body>

      stackcontent <s:property value="t" />

    <hr>

    from application <s:property value="#parameters.t"/>

    <hr>

        <s:debug></s:debug>

      </body>

  • 相关阅读:
    kindeditor 创建多个 取值方式
    新浪微博分享平台地址
    thinkphp 直接写SQL
    nginx下禁止目录运行php
    phpcms_v9 同步登陆的BUG
    yii framework 创建项目
    phpcms_v9 关闭debug
    ucenter忘记创始人密码简单解决方法
    XSS 常见手段
    如何在 C 中使用 64 位整数?
  • 原文地址:https://www.cnblogs.com/flyback/p/8848197.html
Copyright © 2011-2022 走看看