[ http://issues.apache.org/struts/browse/STR-2905?page=all ]
Felipe Desiderati e Souza updated STR-2905:
-------------------------------------------
Description:
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 can't!!!
...
<action type="myClass" ... />
<forward name="f1" path="/f1.jsp" /> <!-- This need to be an include. What
can I do? -->
<forward name="f2" path="/f2.jsp" />
<forward name="f3" path="/f3.jsp" />
</action>
...
Why do I have to do this? Suppose that I need to do a server push. The most
common use of server push, is show a message (Splash Screen) for the user while
the system is processing something else. And then, when the process is done,
the system do an include showing the desire result. But, as I said, to do this,
we have to do an include, because if we use a forward an error will occur, due
to fact that we can't forward a request if we already response something.
So for actions with more than one forwards we can't use the server push! I
guess. 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 inside the
action.
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 verification if it
needs to do 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.
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.
Felipe
was:
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 can't!!!
...
<action type="myClass" ... />
<forward name="f1" path="/f1.jsp" /> <!-- This need to be an include. What
can I do? -->
<forward name="f2" path="/f2.jsp" />
<forward name="f3" path="/f3.jsp" />
</action>
...
Why do I have to do this? Suppose that I need to do a server push. The most
common use of server push, is show a message (Splash Screen) for the user while
the system is processing something else. And then, when the process is done,
the system do an include showing the desire result. But, as I said, to do this,
we have to do an include, because if we use a forward an error will occur, due
to fact that we can't forward a request if we already response something.
So for actions with more than one forwards we can use the server push! I guess.
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 inside the action.
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 verification if it
needs to do 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.
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.
Felipe
> Allow nested tags <include ..> inside 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 can't!!!
> ...
> <action type="myClass" ... />
> <forward name="f1" path="/f1.jsp" /> <!-- This need to be an include. What
> can I do? -->
> <forward name="f2" path="/f2.jsp" />
> <forward name="f3" path="/f3.jsp" />
> </action>
> ...
> Why do I have to do this? Suppose that I need to do a server push. The most
> common use of server push, is show a message (Splash Screen) for the user
> while the system is processing something else. And then, when the process is
> done, the system do an include showing the desire result. But, as I said, to
> do this, we have to do an include, because if we use a forward an error will
> occur, due to fact that we can't forward a request if we already response
> something.
> So for actions with more than one forwards we can't use the server push! I
> guess. 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
> inside the action.
> 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
> verification if it needs to do 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.
> 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.
> 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