首页 > 其他 > 详细

Struts2 带参数的结果集

时间:2016-02-24 17:38:11      阅读:140      评论:0      收藏:0      [点我收藏+]

1、index.jsp

<body>
向结果传参数
<ol>
	<li><a href="user/user?type=1">传参数</li>		
</ol>
</body>

2.struts.xml

<struts> 
 <constant name="struts.devMode" value="true" /> 
 <package name="user" namespace="/user" extends="struts-default">        
        <action name="user" class="com.wxh.action.UserAction">
            <result type="redirect">/userSuccess.jsp?t=${type}</result>
        </action>    
    </package>
</struts>

3.UserAction.java

package com.wxh.action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int type;	
	public String execute() throws Exception{		
	    return "success";		
	}
	public int getType() {
		return type;
	}	
	public void setType(int type) {
		this.type = type;
	}
}

4、userSuccess.jsp

<body>
user Success!
<s:property value="r"/><br>
<s:property value="#parameters.t"/>
<s:debug></s:debug>
</body>


Struts2 带参数的结果集

原文:http://blog.csdn.net/hoho_12/article/details/50730731

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!