struts2 result 如何配置站外地址

sinosinux 2009-06-07 08:15:03
我想要实现的功能是: 在一个struts action中收集前台页面来的表单数据,然后发送给银行的支付网关。支付网关的地址是https://xxxx/paygatway, 那么在struts配置文件中这个action的result该如何写呢? 谢谢!!!
...全文
605 7 打赏 收藏 转发到动态 举报
写回复
用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"

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧