首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Struts2应用开发详解-五、result中的各种转发类型

2012-09-28 
Struts2应用开发详解--5、result中的各种转发类型?????? result配置类似于struts1中的forword,但struts2中

Struts2应用开发详解--5、result中的各种转发类型

???

??? result配置类似于struts1中的forword,但struts2中提供了更多的类型,常用类型有dispatcher(默认值)、redirect、redirectAction、plainText。

?

使用${属性名}表达是的方式访问action中的属性,表达式里的属性对应action中的属性。如下:

<result type="redirectAction">/delete.jsp?id=${id}</result>

?

redirectAction的例子,重定向的路径为同一个包下:

<result type="redirectAction">helloworld</result>

如果重定向的action在别的命名空间下:

<result type="redirectAction">

???? <param name="actionName">helloworld</param>?

???? <param name="namespace">/test</param>

</result>

?

?plainText显示原文件内容,例如:当我们需要显示jsp源代码的时候,我们可以使用此类型。

<result name="source" type="plainText">

???? <param name="location">/*.jsp</param>?

???? <param name="charSet">UTF-8</param><!--?制定读取文件的编码 -->

</result>

?

?

热点排行