社区
Web 开发
帖子详情
struts2中的页面间动态数据传递问题
usb00fa
2010-05-15 11:13:50
在struts1中不能动态的传递数据,如果想动态传递的话,就只有在Action类中的execute方法用foward转发,在struts-config.xml文件中不能配置(例如truts-config.xml文件:不能写path=/next.do?id=表达式),这是struts1的一个硬伤
我想知道的是在struts2中这个问题是怎么解决的(听说可以解决,但是我看了看网上的一些视频,都没有提到这一点),承蒙指点,不知道如何解决
谢谢了
...全文
59
2
打赏
收藏
struts2中的页面间动态数据传递问题
在struts1中不能动态的传递数据,如果想动态传递的话,就只有在Action类中的execute方法用foward转发,在struts-config.xml文件中不能配置(例如truts-config.xml文件:不能写path=/next.do?id=表达式),这是struts1的一个硬伤 我想知道的是在struts2中这个问题是怎么解决的(听说可以解决,但是我看了看网上的一些视频,都没有提到这一点),承蒙指点,不知道如何解决 谢谢了
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
junnef
2010-05-15
打赏
举报
回复
struts2中的result type类型描述
<result-types>
<result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
<result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />
<!-- Deprecated name form scheduled for removal in Struts 2.1.0. The camelCase versions are preferred. See ww-1707 -->
<result-type name="redirect-action" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="plaintext" class="org.apache.struts2.dispatcher.PlainTextResult" />
</result-types>
默认为dispatcher,是action返回后,会把相应的值传递到jsp页面中,比较常用的。
如果需要在action到action之间传递,就是用chain。
而使用redirect则会使传递的信息丢失,具体可以看各个实现类的代码。
crazylaa
2010-05-15
打赏
举报
回复
嗯,楼主搜索:
struts2 result type redirectAction
或
struts2 result type chain
struts
传递
json数据
用 struts 向
页面
传输 json数据
struts2
中
的参数
传递
这个
问题
其实一直很困惑我的,在写平常的jsp程序时,
传递
参数很容易,通过表单,request,链接等都可以
传递
,但是到了
struts2
中
,在写的各个地方,都看不到任何的request或是response,不知道该怎么
传递
参数了,到了...
Struts2
开发框架
本课程主要讲解Struts 2.x开发框架的实现机制以及运行原理分析,同时讲解了Struts 2.x
中
提供的数据验证、上传、拦截器、转换器等概念,并且针对于拦截器的操作进行了合理的结构设计,以提升代码的可重用性。...
struts2
利用值栈实现参数
传递
在
struts2
框架
中
,MVC的设计模式使得视图层和控制层分离,在这之
间
传递
参数可以使用值栈。值栈就是 OGNL 表达式存取数据的地方。在一个值栈
中
,封装了一次请求所需要的所有数据,
Struts2
会为每个请求创建一个新的值...
Struts2
入门(四)
Struts2
参数
传递
在servlet阶段,我们使用request.getParameter和setAttribute的方式进行数据的
传递
,在SpringMVC
中
我们使用了更为先进的参数
传递
方式,那么在讲解
Struts2
的数据
传递
方式后,我们可以自行去对比哪个容易一些!...
Web 开发
81,092
社区成员
341,717
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章