I use tiles for it. A typical set of related definitions in my tiles configuration file:

   <definition name="page.site.home" path="/WEB-INF/jsp/layout/main.jsp">
       <put name="menu" value="action.site.menu" />
       <put name="calendar" value="action.site.calendar" />
       <put name="survey" value="action.site.survey" />
       <put name="greeting" value="tile.site.greeting" />
       <put name="main" value="tile.site.home" />
   </definition>

<definition name="action.site.menu" path="/menu.do"/>
<definition name="action.site.calendar" path="/calendar.do"/>
<definition name="action.site.survey" path="/survey.do"/>
<definition name="tile.site.greeting" path="/WEB-INF/jsp/tile/site/greeting.jsp"/>
<definition name="tile.site.home" path="/WEB-INF/jsp/tile/site/home.jsp"/>


In the main.jsp file I use <tiles:insert> for "menu", "calendar", "survey", "greeting" and "main"

Thompson

Parke Jeff wrote:

I'm still having trouble including a Struts action into a JSP (<c:import
url="/someAction.do" />).


I've tried using absolute URLs, passing the jsessionid to ensure that
the session is not lost, but the request context is different between
the JSP and the included action, so this not suitable for many
situations.  I've also tried upgrading to Struts 1.2.4.  This does not
resolve the "Response has already been committed" issue when including
more than one Struts action in a JSP.

The app server is using JRE 1.4.1_03-b02.

Can anyone tell me whether they have seen this situation before?  How
common is it?  Is it unusual to include Struts actions in JSPs?  Anyone?

Thanks,
Jeff

-----Original Message-----
From: Parke Jeff Sent: Tuesday, November 02, 2004 3:23 PM
To: [EMAIL PROTECTED]
Subject: [****] Including a Struts action in a JSP -
IllegalStateException / truncated response issue


Hello,



I've seen a few posts on this subject, through this and other resources,
but I haven't seen any appealing workarounds.  I'd like to try to bring
all the relevant information from these posts together and then ask for
help in identifying a viable workaround.  I apologize in advance if this
issue is well known and understood and I just missed the best resources
on the subject.



Goals:

1)       To build a Struts application where _every_ request to the
application goes through a Struts action that collects and packages data
then forwards (using Struts ActionForward's) to a JSP.

2)       To be able to include one or more Struts actions in any given
JSP (ie: <c:import url="/someAction.do" />).



Behavior when implementing these goals:

1)       Usually, when executing a single include of a Struts action on
a JSP, everything works fine though sometimes there are problems (as
listed below).

2)       When including more than one Struts action on a JSP I get an
IllegalStateException - Response has already been committed.

3)       Sometimes, when a JSP only includes one Struts action, the
first x bytes of the response will be missing when it is returned
(without exception) to the client.



Relevant issues (correct me where I'm wrong):

1)       Including (<jsp:include>, <c:import>, etc.) a JSP/Servlet on a
JSP sometimes (always?) causes the response to be committed because
includes use RequestDispatcher.include() which in turn commits the
response.

2)       Forwarding a request using an ActionForward from a Struts
action to a JSP can not be done when a response has been committed.

3)       Increasing the response buffer size has no effect on these
issues.

4)       Using the include directive (<%@ include file="filename" %>)
won't work because that includes source a translation time.

5)       It has been reported that using <tiles:insert> does not
(fully/always?) resolve the problematic behavior.

6)       Using absolute URLs with <c:import> prevents the response from
being committed because the context of the request is assumed to be
independent.  The visibility of an authenticated, populated session can
be affected by passing the jsessionid in on the URL.  This seems to be
the only viable workaround though I haven't tested it thoroughly yet.



Reference:

http://www.mail-archive.com/[EMAIL PROTECTED]/msg13284.html

http://www.jguru.com/faq/view.jsp?EID=501393

http://www.mail-archive.com/[EMAIL PROTECTED]/msg05711.htm
l

http://www.mail-archive.com/[EMAIL PROTECTED]/msg15194.html

http://forum.java.sun.com/thread.jsp?thread=484731&forum=45&message=2266
277

http://www.mail-archive.com/[EMAIL PROTECTED]/msg15189.html

http://jguru.com/forums/view.jsp?EID=1204797

http://forum.java.sun.com/thread.jsp?thread=461644&forum=45&message=2115
900

http://www.mail-archive.com/[EMAIL PROTECTED]/msg18018.html

http://www.mail-archive.com/[EMAIL PROTECTED]/msg74816.html

http://www.mail-archive.com/[EMAIL PROTECTED]/msg29073.html



My setup:

-          Oracle AS 10g (OC4J) app server

-          Struts 1.1

-          JSTL 1.0.6



Is there any clean way to meet the two goals listed above without error?



Thanks,

Jeff




















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









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



Reply via email to