I solved this problem, by using the source of the struts IncludeAction. I hijacked that code and did my List generation before the the RequestDispatcher formward call, so it looks like:
Action snippet: ****************** List menuItems = getMenuItemsList(); req.setAttribute("menuitems", menuItems); RequestDispatcher rd = servlet.getServletContext().getRequestDispatcher("/WEB-INF/jsp/frontend/footer_include.jsp"); // Forward control to the specified resource rd.include(req, res); // Tell the controller servlet that the response has been created return (null); ********************************** So I'm wondering, has anyone ever heard of a proposal to allow for an <include> tag inside an <action> tag in the struts config, to complement the <forward> tag? so instead of the above i could just config like this: <action path="/sidenav" type="com.whatever.actions.SideNavAction"> <include name="showForm" path="/WEB-INF/jsp/sideNav_form.jsp" /> </action> It would seem like useful functionality and a more clear and struts like solution to the above problem. dave On Mon, 2005-12-12 at 18:12 -0800, David Evans wrote: > Hello all, > > I have a requirement for a dynamically created menu on all pages of a > web site i am creating. So i created an action that creates a List of > MenuItems, and then forwards to a jsp that uses jstl to forEach through > the list and generate the appropriate html. the jsp page only has the > snippet of html for the menu div of the page. I am including this action > in "static" html pages via the use of apaches SSI module like this: > <!--#include virtual="/apps/footer" --> > > and thought i was going to use jsp:include to include it in all of the > jsp pages to which my applications actions are forwarding, like this: > <jsp:include page="/apps/footer" /> > > However when i attempt to do that i get a: > > java.lang.IllegalStateException: Cannot forward after response has been > committed > > This does work: > <c:import url="http://www.domainname.com/apps/footer" /> > but i'd prefer not to have to use that, because then i'll have to change > it when things move from dev to production, so far my jsp's have no site > specific information, so i can just copy them. > > So can someone tell me how/if i can include the results of an action in > a jsp that is being forwarded to from another action? > > Thanks > > Dave > > > --------------------------------------------------------------------- > 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]