<!-- 配置 -->
  <forward name="a" path="a.do" />

<!-- Action中的代码 -->
ActionForward forward=mapping.findForward("a");  
ActionForward newForward=new ActionForward(forward);
String newPath=forward.getPath()+"&id=1"
newForward.setPath(newPath);
return newForward;
 
<!-- Action中的代码(第二种) -->
return new ActionForward ("a.do?id=1");


这种办法我常用,即不用再Action中写死目标地址,又可以增加动态参数。

Strust-config给你配置的目的是为了将物理地址命名,从而做到一层抽象,如果在程序中写死,就失去了设计的意义,如果需要变更这个地址的话,就要改动很多代码。

 

总结来自:http://topic.csdn.net/u/20071205/11/fd20e41c-6b71-4d1b-9d56-ebe1c1583200.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-11-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2022-01-12
  • 2022-12-23
  • 2022-01-05
  • 2021-07-02
相关资源
相似解决方案