(急)关于Struts1.2的action 跳转问题 怎么从一个action跳到另一个action,跳的时候要带参数。高手们帮帮忙,感激不尽 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你把参数放在session中不是很好吗! requerst中seseion中?传值方法很多撒 在config配置文件中要加parameter = "参数名" *.do?参数名=值Eg Expression.do?value(Modle)=list 你说从一个Action跳到另一个Action? 你想做什么呢?为什么不直接跳到第2个Action? struts Action跳到Action是这样做的根据你xml配置的<forward name="test" path="/index/test.do" />用 mapping.findForward("test");跳转test就是forward name你想传值request.setAttribute("名", 值);放到request作用于里就好了在那个action Get出来,根本不需要url传值public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // TODO Auto-generated method stub String id = request.getParameter("id"); String step = request.getParameter("step"); HttpSession session = request.getSession(true); if (id!=null && "".equals("id")!=true) { List list = tbiz.GetQuestionByqid(Integer.parseInt(id)); session.setAttribute("qlist", list); request.setAttribute("step", list.get(0)); request.setAttribute("s", 0); return mapping.findForward("test"); }}<action path="/index/test" type="org.springframework.web.struts.DelegatingActionProxy"> <forward name="test" path="/index/test.do" /></action> 给你一个例子,里面的参数也可以是${userName}的形式取得你Action里面的属性,记着在你的Action返回result的时候范围这个result name. <action name="gatherReportInfo" class="..."> <result name="showReportResult" type="redirect-action"> <param name="actionName">generateReport</param> <param name="namespace">/genReport</param> <param name="reportType">pie</param> <param name="width">100</param> <param name="height">100</param> </result> </action> new ActionForward("action.do?param=¶m=....");这样可以传更多参数如果通过配置文件后面只能够跟一个参数 <action name="aaction" path="/A.do" type="...."><forward name="" path="/B.do"/><forward name="" path="/c.jsp"/></action> Generic Dao 连接查询 求学习用的J2EE源码 Spring2.0在Struts1.2中使用拦截器问题 union 在spring +hibernater 中用什么代替? 关于struts中indexId的问题 请问j2ee1.4的启动命令是?? 求助struts方面的书籍和使用手册 请问高手一个简单的问题??? 为什么在WONDOWS 2003下,WEBLOGIC8.1.1连不上linux下的ORACLE8.1.7 html中的div怎么用? 什么是抽像类!抽像类和非抽像类有什么区别!抽像类相对于非抽像类有什么优点! 求MySQL与Oracle的分页项目实例
seseion中
?传值
方法很多撒
parameter = "参数名"
Eg Expression.do?value(Modle)=list
为什么不直接跳到第2个Action?
用 mapping.findForward("test");跳转test就是forward name
你想传值request.setAttribute("名", 值);放到request作用于里就好了
在那个action Get出来,根本不需要url传值
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
String id = request.getParameter("id");
String step = request.getParameter("step");
HttpSession session = request.getSession(true);
if (id!=null && "".equals("id")!=true)
{
List list = tbiz.GetQuestionByqid(Integer.parseInt(id));
session.setAttribute("qlist", list);
request.setAttribute("step", list.get(0));
request.setAttribute("s", 0);
return mapping.findForward("test");
}
}<action path="/index/test" type="org.springframework.web.struts.DelegatingActionProxy">
<forward name="test" path="/index/test.do" />
</action>
<action name="gatherReportInfo" class="...">
<result name="showReportResult" type="redirect-action">
<param name="actionName">generateReport</param>
<param name="namespace">/genReport</param>
<param name="reportType">pie</param>
<param name="width">100</param>
<param name="height">100</param>
</result>
</action>
这样可以传更多参数
如果通过配置文件后面只能够跟一个参数
<forward name="" path="/B.do"/>
<forward name="" path="/c.jsp"/>
</action>