社区
Web 开发
帖子详情
struts2 result 如何配置站外地址
sinosinux
2009-06-07 08:15:03
我想要实现的功能是: 在一个struts action中收集前台页面来的表单数据,然后发送给银行的支付网关。支付网关的地址是https://xxxx/paygatway, 那么在struts配置文件中这个action的result该如何写呢? 谢谢!!!
...全文
605
7
打赏
收藏
struts2 result 如何配置站外地址
我想要实现的功能是: 在一个struts action中收集前台页面来的表单数据,然后发送给银行的支付网关。支付网关的地址是https://xxxx/paygatway, 那么在struts配置文件中这个action的result该如何写呢? 谢谢!!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dawnstar2008
2009-06-08
打赏
举报
回复
<result name = "redirect">http://xxxx/paygatway</result>
redlotus_lyn
2009-06-08
打赏
举报
回复
<result type="redirect">https://xxxx/paygatway</result>
duqiancheng
2009-06-08
打赏
举报
回复
6楼很全了
cust28
2009-06-08
打赏
举报
回复
楼上回答的都正确,struts2中定义了以下几种类型
其中,最后两行已经不推荐使用了
<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. ...-->
<result-type name="redirect-action" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="plaintext" class="org.apache.struts2.dispatcher.PlainTextResult" />
</result-types>
可以根据实际情况,设置type="xxx",拿你的例子来说就是
type = "redirect" 重定向
3楼到4楼回答错了,不是name="redirect"而是 type ="redirect"
根据struts2中action返回的字符串,跟name匹配.
如果不指定name则默认为name="success"
Match_Seller
2009-06-08
打赏
举报
回复
<result name = "redirect">http://xxxx/paygatway </result>
lvkai0452
2009-06-08
打赏
举报
回复
[Quote=引用 3 楼 dawnstar2008 的回复:]
<result name = "redirect">http://xxxx/paygatway </result>
[/Quote]
同上
jumpheightway
2009-06-07
打赏
举报
回复
type="redirect"
Struts2
实战.pdf
《Struts 2实战》结合实例介绍了Struts 2框架,主要内容包括Action、
Result
、Interceptor等框架组件,基于注解的
配置
选项等新特征,Struts 2插件 FreeMarker,如何从Struts 1和WebWork 2迁移到Struts 2,Ajax标签、...
深入详解
Struts2
——struts.xml
配置
之
Result
配置
详解
一个
result
代表了一个可能的输出,当Action类的方法执行完成时,它返回一个字符串的结果码,框架根据这个结果码选择对应的
result
,向用户输出。
result
元素有两个属性 name:指定
result
的逻辑名 type:指定
result
的...
Struts2
Result
配置
详解
<br />说明:在前面的许多案例中我们所用到的Action 基本都继承自ActionSupport 这个类,而在这个类中我们定义了五个字段:SUCCESS ,NONE ...标准完整形式如下: <
result
name="su
【
Struts2
学习笔记】3:
Struts2
中Action和
result
处理的
配置
配置
Action 在struts.xml中的包下,格式是: ... <package ...> <action name="Action的名称" [class="实现类所在的java包.实现类名"]> ... </...
Struts2
-关于struts.xml文件的
result
配置
的说明
当action类的方法执行完后,会返回一个字符串,
Struts2
框架根据这个字符串去匹配该action下的
result
,然后像用户输出视图(也可以是重定向,接下来会讲)。二、
result
的
配置
:
result
元素的属性属性是否必须说明name...
Web 开发
81,092
社区成员
341,718
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章