我在看一个structs-config.xml的时候,看到了一个配置:       <action path="/run/report/editReportDefinitions"
         type="XXX.XXX.PrepareReportDefinitionAction"
         name="reportDefinitionForm"
      >
         <forward name="editReportDef" path="/run/report/editReportDefinitions" />
      </action>
然后在PrepareReportDefinitionAction.java中的逻辑也很奇怪:doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
long id = getParaAsLong(request, RequestPara.ALL_ID, PersistentObject.NULL_ID);
if (id == PersistentObject.NULL_ID) {
///////
       //最后的return逻辑如下:
        return mapping.findForward("editReportDef");
   。
   }
一段是出错的逻辑,显示错误jsp页面,正常逻辑最后又return到了forward那里,这不是死循环了?通过structs-config.xml的定义,应该又回到了editReportDefinitions
请问大家这是怎么回事呢? 难道有办法从这个唯一的
 <forward name="editReportDef" path="/run/report/editReportDefinitions" />
转出来么?这是个常用法或者什么技巧么?

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【dotcn2004】截止到2008-07-14 20:32:45的历史汇总数据(不包括此帖):
    发帖的总数量:3                        发帖的总分数:220                      每贴平均分数:73                       
    回帖的总数量:2                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:1                        结贴的总分数:20                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:2                        未结的总分数:200                      
    结贴的百分比:33.33 %               结分的百分比:9.09  %                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    楼主该结一些帖子了
      

  2.   

    就算是自己调用自己,那也该有个终止条件吧,可我看不到这个地方有什么终止条件每次进来doexecute都会最后走到forward转出去,这是怎么回事呢
      

  3.   

    如果是继承了DispatherAction的话,可以根据参数的不同调用不同的方法,没有参数的话可以设定一个没有参数的跳转路径
      

  4.   

    STRUTS本身有个TILES插件,多半是使用了这个东西,当返回path="/run/report/editReportDefinitions"时,它会在tiles-defs.xml里面去找/run/report/editReportDefinitions对应的页面.如果你把<forward name="editReportDef" path="/run/report/editReportDefinitions" /> 改成
    <forward name="editReportDef" path="/run/report/editReportDefinitions.do" /> 
    这样才会是循环
      

  5.   

    谢谢,是回到tile配置的mapping中去了