I'm not sure he actually intended to do multiple forwards, it seems like he just
wanted to reuse an action to generate some common output. The fact that Struts
is performing an implicit forward in response to each of those imports can be
easy to overlook.

Mick, if you want a lower-level analogy, this is sort of equivalent to using
RequestDispatcher.include on a resource that performs a
RequestDispatcher.forward. If you check out the docs, you'll see that forward
should be called before the response is committed. If the response is already
committed, an exception will be thrown. Even if you had few enough numbers in
your list to avoid the exception (output still buffered), you probably won't
get the results you're looking for. As part of the processing of a forward, the
container will automatically discard any currently buffered output.

As Rick also points out, you'll have to rethink how you have things architected.
You may be able to get away with just including a JSP fragment to handle some
common formatting tasks:

<c:forEach var="number" items="${listOfNumbers}">
  <%-- static inclusion of a fragment, can access ${number} directly --%>
  <%@ include file="processNumber.jspf" %><br/>
</c:forEach>

Quoting Rick Reumann <[EMAIL PROTECTED]>:

> Mick Wever wrote the following on 10/13/2004 11:53 AM:
> 
> >         <c:import url="/customAction.do?number=${number}"/>
> 
> I guess this would be like doing the equivalent of trying to do a 
> forward. On your second loop you'll have already wrote stuff out to the 
> JSP so I don't think you could then do any forwarding. Any reason why 
> you are trying to do fowards within a forEach loop? I can't imagine what 
> good that could accomplish? If there was a bunch of different processing 
> you needed to do, do that in one action business method (do the looping 
> there, not in the JSP).
> 
> -- 
> Rick

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to