Allow nested tags <include ..> insinde an action <action ...></action>
----------------------------------------------------------------------

         Key: STR-2905
         URL: http://issues.apache.org/struts/browse/STR-2905
     Project: Struts 1
        Type: Improvement

  Components: Core  
    Versions: 1.2.9    
 Environment: System: Microsoft Windows XP (Version 2002 - Service Pack 2)
App Server: Tomcat 5.5.9
Struts Version; 1.2.9
    Reporter: Felipe Desiderati e Souza
    Priority: Minor


I know that is possible to do an include instead of a forward, but it's only 
possible to use in declarations like this:

...
<action path="/something" include="/path/to/my/file.jsp" />
...

So if I need to do an include using an action that has more than one forward 
and/or include, I need to do something like this:

...
<action type="myClass" ... />
   <forward name="f1" path="/f1Include.do" /> <!-- This need to be an include 
-->
   <forward name="f2" path="/f2.jsp" />
   <forward name="f3" path="/f3.jsp" />
</action>
<action path="/f1Include" include="/f1.jsp" />
...

So Why do we have to do this? First, because the <forward ../> tag doesn't have 
any attribute that tells that this forward should be an include. And second, 
because doesn't exist any nested tag like <include ../> to replace the <forward 
../> tag.

I don't know if exists any problem in use this approach, i.e., add the <include 
../> tag to struts DTD, and in the Request Processor add a veirifcation if it's 
a forward or an include. Like is done with single action, showed in the first 
example above. So, if we use the first example, the Request Processor verifies 
if it needs to do an forward, if not then it verifies if it needs to do an 
include. As you can see in follow piece of code:

...
 public void process(HttpServletRequest request, HttpServletResponse response) {
   ...
   if (!processForward(request, response, mapping)) {
      return;
   }
        
   if (!processInclude(request, response, mapping)) {
      return;
   }
   ...
}
...

But if we have to do anything like what was showed in the second example, we 
can't. Unless we use that approach.

I realize with this solution of adding the tag <include>, we still have the 
backward compatibility and an improvement to setup an include on actions with 
multiples forwards/includes, without use any more action.

Felipe

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to