struts2 result param

Docker部署 SRS rtmp/flv流媒体服务器 SRS(Simple Realtime Server)是一款开源的流媒体服务器,具有高性能、高可靠性、高灵活性的特点,能够支持直播、点播、转码等多种流媒体应用场景。SRS 不仅提供了流媒体服务器,还提供了适用于多种平台的客户端 SDK 和在线转码等辅助服务,是一款十分强大的流媒体解决方案。 阅读详情

在struts.xml配置文件中遇到了param,有点迷糊,上网查了查……似乎明白些了

<action name="Log*" method="loginFrame{1}" class="member.loginIndeAct">
   <result>${tplPath}</result>
   <result name="logout" type="redirectAction">
    <param name="namespace">/jeecms</param>
    <param name="actionName">LoginFrameInput</param>
   </result>
  </action>

这里的action 是Log,他包含了登陆和退出,当系统在登录的时候就直接返回${tplPath}就可以了;在退出的时候需要返回到登陆页面,所以退出的时候是转发到 action的,转发到action肯定要告诉系统转发到那个action,该action的namespace是什么,名字是什么,就是通过param 该属性老告知struts2的;当然param还有其他用法,不过一般就用这个就差不多了,综上得出:

param标签主要用于为其他标签提供参数,例如bean和include标签。
param参数设置:
name:可选属性,指定设置参数名称
value:可选属性,指定参数的值
id:可选属性,指定该元素引用id

看到这,野猪似乎感觉清楚了许多,嘿嘿……

下面还搜到了一些信息,等野猪不是很清楚的时候再看看吧……

chain       
    用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息。       
    com.opensymphony.xwork2.ActionChainResult       
dispatcher       
    用来转向页面,通常处理JSP       
    org.apache.struts2.dispatcher.ServletDispatcherResult       
freemaker
       
    处理FreeMarker模板       
    org.apache.struts2.views.freemarker.FreemarkerResult       
httpheader       
    控制特殊HTTP行为的结果类型       
    org.apache.struts2.dispatcher.HttpHeaderResult    
stream       
    向浏览器发送InputSream对象,通常用来处理文件下载,还可用于返回AJAX数据       
    org.apache.struts2.dispatcher.StreamResult       
velocity       
    处理Velocity模板       
    org.apache.struts2.dispatcher.VelocityResult       
xslt       
    处理XML/XLST模板       
    org.apache.struts2.views.xslt.XSLTResult       
plainText       
    显示原始文件内容,例如文件源代码       
    org.apache.struts2.dispatcher.PlainTextResult       
plaintext       
    显示原始文件内容,例如文件源代码       
    org.apache.struts2.dispatcher.PlainTextResult 
redirect     
    重定向到一个URL ,被跳转的页面中丢失传递的信息,如request      
    org.apache.struts2.dispatcher.ServletRedirectResult       
redirectAction
       
    重定向到一个Action ,跳转的页面中丢失传递的信息,如request         
    org.apache.struts2.dispatcher.ServletActionRedirectResult       
redirect-action       
    重定向到一个Action ,跳转的页面中丢失传递的信息,如request         
    org.apache.struts2.dispatcher.ServletActionRedirectResult    
注:redirect与redirect-action区别

一、使用redirect需要后缀名 使用redirect-action不需要后缀名 
二、type="redirect" 的值可以转到其它命名空间下的action,而redirect-action只能转到同一命名空下的 action,因此它可以省略.action的后缀直接写action的名称。
如:

<result name="success" type="redirect">viewTask.action</result> 
<result name="success" type="redirect-action">viewTask</result>

附:redirect-action 传递参数

 
  1. <action name="enterpreinfo" class="preinfoBusinessAction"    method="enterPreinfoSub">  
  2.   <result name="success" type="redirect-action">  
  3.      showpreinfo?preinfo.order_number=${preinfo.order_number}&amp;preinfo.company_name=${preinfo.company_name}   
  4.   </result>  
  5.  <result name="error" type="redirect">  
  6.     <param name="location">/error.jsp</param>  
  7.  </result>  
  8. </action>  

   因为使用了redirect-action,所以要注意不能将 showpreinf?preinfo.order_number=${preinfo.order_number}写成 showpreinf.action?preinfo.order_number=${preinfo.order_number}

其中${}为EL表达式,获取action:enterpreinfo中属性的值;在这个配置文件里,多个参数的连接符使用了"&amp;",但XML的语法规范,应该使用"&amp;"代替"&",原理和HTML中的转义相同,开始没有注意,在struts分析配置文件时,总是报出这样的错误:

json   一般很容易忽略的一个地方(在EXT中非常有用)
示例
 
  1. <package name="struts2" extends="json-default" namespace="/">  
  2.         <action name="login" class="loginAction" method="login">  
  3.             <result type="json">  
  4.                 <param name="includeProperties">success,result</param>                
  5.             </result>               
  6.         </action>  
  7.         <action name="main" class="loginAction" method="main">  
  8.             <result name="main">/index.jsp</result>           
  9.         </action>   
  10.     </package>  
 
  1. private boolean success  = true;  
  2. private String result = "main.action";  
  3. //getter和setter方法略  
以上的success和result互相对应到了
 
  1. <param name="includeProperties">success,result</param>    
struts2会根据其设置的值匹配跳转
对于json一般情况下很少用到,但是在处理ext的时候会用到这个属性类型,这个地方也是经常被忽略的。

最后感觉还是应该查一下文档给野猪看看,嘿嘿:

Redirect Action Result

  • actionName (default) - the name of the action that will be redirect to
  • namespace - used to determine which namespace the action is in that we're redirecting to . If namespace is null, this defaults to the current namespace
<package name="public" extends="struts-default">
    <action name="login" class="...">
        <!-- Redirect to another namespace -->
        <result type="redirect-action">
            <param name="actionName">dashboard</param>
            <param name="namespace">/secure</param>
        </result>
    </action>
</package>

<package name="secure" extends="struts-default" namespace="/secure">
    <-- Redirect to an action in the same namespace -->
    <action name="dashboard" class="...">
        <result>dashboard.jsp</result>
        <result name="error" type="redirect-action">error</result>
    </action>

    <action name="error" class="...">
        <result>error.jsp</result>
    </action>
</package>

<package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
   <-- Pass parameters (reportType, width and height) -->
   <!--
   The redirect-action url generated will be :
   /genReport/generateReport.action?reportType=pie&width=100&height=100
   -->
   <action name="gatherReportInfo" class="...">
      <result name="showReportResult" type="redirect-action">
         <param name="actionName">generateReport</param>
         <param name="namespace">/genReport</param>
         <param name="reportType">pie</param>
         <param name="width">100</param>
         <param name="height">100</param>
      </result>
   </action>
</package>

Redirect Result

  • location (default) - the location to go to after execution.
  • parse - true by default. If set to false, the location param will not be parsed for Ognl expressions.
  • <result name="success" type="redirect">
      <param name="location">foo.jsp</param>
      <param name="parse">false</param>
    </result>
    <package name="passingRequestParameters" extends="struts-default" namespace="/passingRequestParameters">
       <-- Pass parameters (reportType, width and height) -->
       <!--
       The redirect-action url generated will be :
       /genReport/generateReport.jsp?reportType=pie&width=100&height=100
       -->
       <action name="gatherReportInfo" class="...">
          <result name="showReportResult" type="redirect">
             <param name="location">generateReport.jsp</param>
             <param name="namespace">/genReport</param>
             <param name="reportType">pie</param>
             <param name="width">100</param>
             <param name="height">100</param>
          </result>
       </action>
    </package>

这下感觉怎么样了?野猪!多看看文档!

最后,又看了一眼result的默认参数:

<result name="success" type="dispatcher">
    <param name="location">/ThankYou.jsp</param>
</result>

呵呵……这还比较满意!吃饭去!野猪!

解决Docker拉取镜像报错:Get https://registry-1.docker.io/v2/: 报错 解决Docker拉取镜像报错: Get “https://registry-1.docker.io/v2/”: net/http: request canceled while waiting for connection问题描述Get "https://registry-1.docker.io/v2/"是docker官方的镜像源,下载很慢的,一般会自己指定国内映射的加速镜像源。 阅读详情

相关推荐

图像特征(一)——颜色特征(颜色直方图,颜色矩,颜色集,颜色聚合向量和颜色相关图)

本文主要是为了更好地理解图像特征,理解各方法的原理。转载请注明出处https://mp.youkuaiyun.com/console/editor/html/105090183 图像模式识别的一般步骤为:输入图像--图像预处理--特征提取--特征选择--图像分类--输出结果。 图像特征主要有:颜色特征、形状特征、纹理特征和空间关系特征。 本文主要介绍颜色特征,并给出matlab上实现的demo。 颜...

gloria_iris的博客 3万+

struts2配置JSON(上)

struts2配置JSON(includeProperties)     includeProperties: 这个属性表示要包含进JSON数据中的数据。 < / param > excludeProperties: 这个属性表示不要包含进JSON数据中的数据。 true excludeNullProperties: 这个属性表示去除空数据。

yudungang@csdn 672

从零构建2.4G无线通信系统:MSPM0G3507与NRF24L01的深度协同设计

本文详细介绍了基于MSPM0G3507微控制器与NRF24L01射频模块构建2.4G无线通信系统的深度协同设计方案。内容涵盖系统架构、SPI通信优化、功耗管理、抗干扰机制及中断/DMA高效利用,为工业物联网应用提供高可靠、低功耗的无线传输解决方案。

rice5的博客 821

Struts2中 Result类型配置详解

一个result代表了一个可能的输出。当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出。在com.opensymphony.xwork2.Action接口中定义了一组标准的结果代码,可供开发人员使用,当然了只有我们的action继承ActionSupport 这个类才可以使用下面的结果代码,如下所示:public interfa...

weixin_30432007的博客 556

用Verilog在FPGA上做个电子琴:从矩阵键盘到蜂鸣器的完整实现(附代码)

本文详细介绍了如何使用Verilog在FPGA上实现一个完整的电子琴系统,涵盖矩阵键盘扫描、音调生成和蜂鸣器驱动等核心模块。通过模块化设计和PWM调制技术,开发者可以构建一个可交互的音乐播放器,项目代码完整且易于扩展,适合FPGA初学者和数字逻辑设计爱好者实践。

weixin_29191669的博客 403

SAP数据导入工具(LSMW) 超级详细教程(批量导入内部订单)

用户提了个需求,让我批量导入内部订单几百个内部订单。我本打算用写段ABAP 代码来调用 BAPI (BAPI_INTERNALORDER_CREATE)就可以了。但想到我很久没有用过LSMW 了,都快要忘记了。于是我采用LSMW的方式,完成了任务。并把过程记录下来,形成教程方便我以后回头查看,分享出来也希望对大家有帮助。

IT小职员 2万+

3.项目中的公共返回类CommonResult

一、介绍 在web层与前端或者与其他系统进行交互时,一般在项目(应用)返回统一的参数格式,此公共返回类 CommonResult即是用作此。 二、CommonResult import com.fasterxml.jackson.annotation.JsonIgnore; import com.xw.sun.train.constant.ResponseStatusConstant; import org.springframework.util.Assert; import java.io.Serial

苏秋远的博客 7877

EtherCAT从站协议栈---- sampleappl.c 文件解析

这个源文件实际上包含该项目的入口函数main函数。 那么如何找到入口函数呢? 可以进入debug的simulator模式,选中run to main(), 当执行完启动文件startup_cm3.s后就进入了main函数(注意在main函数之前还进入了SystemInit函数), 如下图所示: 这个main函数主要架构如下: int main(void) { HW_Init(); /*PDI(过程数据接口)初始化,这里用的是MCI接.

Jiawei_Z的博客 3068

Java工具类Result<T>

public class Result<T> { /** * 状态码 */ private String status; /** * 获取状态。 * * @return 状态 */ public String getStatus() { return status; } /** * 状态信息,错误描述. */ private String

Marblog 1万+

【目标追踪】python背景模型减除法原理及其实现

python基于背景模型差法的视频目标追踪帧差法的问题:背景模型差法目标追踪原理1. 基本思路:2. 图例讲解:3. 存在的问题&如何解决:4. 最终效果预览第一步——调用摄像头:1. 使用opencv打开视频or摄像头:2. 读取逐帧图片:第二步——处理图片:1. 转换成灰度图:3. 累加权重重构背景:3. 计算像素差:3. 使用中值滤波和膨胀腐蚀去噪:3.1 中值滤波:3.2 图像腐蚀...

梁瑛平的博客 1948

【STM32系统及仿真】基于STM32+蓝牙设计的智能窗帘系统__资料编号8

本项目设计并实现了一种基于STM32单片机的智能窗帘系统,集成了光敏传感器、温湿度传感器、蓝牙模块和OLED显示屏,实现了窗帘的自动调节、环境监测和远程控制功能。系统采用STM32F103C8T6作为主控制器,通过光敏传感器检测环境光强,温湿度传感器监测室内环境,蓝牙模块实现与手机APP的通信,用户可以通过APP远程控制窗帘的开合状态。系统在检测到环境光照强度或温度超出设定范围时,可自动调节窗帘的开合,以达到节能和提高舒适度的目的。

嵌入式阿齐Archie 2万+

关于struts2 result param

记录下算是struts笔记 &lt;result type="json"&gt; &lt;!-- 这里指定将被Struts2序列化的属性,该属性在action中必须有对应的getter方法 --&gt; &lt;!-- 默认将会序列所有有返回值的getter方法的值,而无论该方法是否有对应属性 --&gt; ...

Z-VegetableBird的博客 837

FFTW3库在Windows中的安装和使用

Windows 32位平台下载:FFTW Installation on Windows。

weixin_45397344的博客 951

struts2中struts.xml 的result 和param

在struts.xml配置文件中遇到了param,有点迷糊,上网查了查……似乎明白些了    ${tplPath}         /jeecms     LoginFrameInput        这里的action 是Log,他包含了登陆和退出,当系统在登录的时候就直接返回${tplPath}就可以了;在退出的时候需要返回到登陆页面,所以退出的时候是转发到 acti

jaub的技术专栏 2342

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

关于struts2 result param name的详解

result type="json">                                                      param name="root">dataMapparam>                                    param name="excludeNullProperties">trueparam>               

a13164815445的博客 2645

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Struts2 - result标签的param标签的name属性用法。

例子: struts.xml的配置如下:    s_main /sso /artDialog.html 先看第一部分:如果action:BaishaSubmit的login方法返回字符串为success,则跳转至 命名空间为/sso 的名字为s_main的action。 此处为跳转至下面的后台登录的部分。

看不过的黑工坊 1万+

struts2 各result类型的param,stream和json

result   类型  为stream      &lt;action name="ss"&gt;   &lt;result type="stream"&gt;    //指定被下载文件的文件类型    //image/jpg   图片jpg    //image/gip   图片gif    //application/zip     &lt;param name="contentTy...

109

struts2 json result param name 是 root 和includeProperties 时的微小区别

struts2 json result param name 是 root 和includeProperties 时的微小区别

yyx的专栏 8345

Struts2 result param includeProperties几种正则规则实例

includeProperties的几种正则方式 <param name="includeProperties">isUsed.*,pageBean\.pageSize,pageBean\.list\[\d+\]\.clinicEntity\.clName,pageBean\.list\[\d+\]\.id,...</param> 转载于:https://www.cn...

weixin_30516243的博客 296

struts2 result 传参数

在struts.xml配置文件中遇到了param,有点迷糊,上网查了查……似乎明白些了    ${tplPath}         /jeecms     LoginFrameInput        这里的action 是Log,他包含了登陆和退出,当系统在登录的时候就直接返回${tplPath}就可以了;在退出的时候需要返回到登陆页面,所以退出的时候是转发到 acti

qq_29663071的博客 818

struts.xml中关于param的配置

在struts.xml配置文件中遇到了param,有点迷糊,上网查了查……似乎明白些了    ${tplPath}         /jeecms     LoginFrameInput        这里的action 是Log,他包含了登陆和退出,当系统在登录的时候就直接返回${tplPath}就可以了;在退出的时候需要返回到登陆页面,所以退出的时候是转发到 acti

zy08403的专栏 1283

Struts中配置的result

在struts.xml配置文件中遇到了param,有点迷糊,上网查了查……似乎明白些了    ${tplPath}         /jeecms     LoginFrameInput        这里的action 是Log,他包含了登陆和退出,当系统在登录的时候就直接返回${tplPath}就可以了;在退出的时候需要返回到登陆页面,所以退出的时候是转发到 acti

MoYanHanHuiLengMa的博客 724

错误日志——The result type [org.apache.struts2.json.JSONResult] doesn't have a default param

负责struts2的Lukasz Lenart 对这个Bug的回复。 Lukasz Lenart added a comment - 30/Jul/13 07:00 In 2.3.16 probably, if you register a new issue I will assign a valid Fix version to it. 可以看出这个错误是struts2 的bug。解决方

坚果壳不是硬壳的专栏 3399
上一篇: Struts.properties 属性文件
下一篇: EXT核心API详解(一) - Ext类
轻鸿飘羽
博客等级 码龄16年 124粉丝 74原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值