struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Riley" <kri...@allconnect.com>
Subject [TILES] Problem using struts actions in tile's template
Date Tue, 22 Oct 2002 21:18:57 GMT
I'm probably being dense here (not an uncommon occurance) but I seem to be unable to 
create a tile layout that uses multiple actions. I have a sample below that I'm using to 
test. When I run this, I don't get any output for the header.do action call. Ultimately I
would
like to have a layout that calls 4 or 5 actions but I'd like to get my test app working first
:).

--------struts-config.xml-------
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
  <form-beans></form-beans>

  <action-mappings>
    <action    path="/header"
               type="com.mycompany.test.HeaderAction">
		<forward name="success" path="/jsp/header.jsp"/>              
    </action>
  
    <action    path="/content"
               type="com.mycompany.test.HeaderAction">
		<forward name="success" path="/jsp/content.jsp"/>              
    </action>
  </action-mappings>
</struts-config>
-------END struts-config.xml-----

------temptest.jsp---------------
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert template="/template.jsp">
    <tiles:put name="title" content="Service Address" direct="true" />
    <tiles:put name="header" content="/header.do" />
    <tiles:put name="content" content="/content.do"/>
</tiles:insert>
------END temptest.jsp-----------

------template.jsp---------------
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<html:html>
<head><title><tiles:get name="title"/></title>
</head>
<body>
<table align="left" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><tiles:get name="header" /></td></tr>
<tr><td></td></tr>
<tr><td>
   <table border="0" cellspacing="0" cellpadding="0" width="100%">
   <tr>
   <td></td>
   <td><tiles:get name="content"/></td>
   </tr></table></td>

</tr>
<tr><td></td></tr>
</table>
</body>
</html:html>
------END template.jsp-----------

------header.jsp-----------------
<h3>THIS IS THE HEADER!!!!</h3>
------END header.jsp-------------

------content.jsp----------------
<B>THIS IS THE CONTENT!!</B>
------END content.jsp------------

Note:HeaderAction and ContentAction are identical except for their name. just used for testing
------ContentAction.java---------
package com.mycompany.test;

import org.apache.struts.action.*;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;

public class ContentAction extends Action {

    public ActionForward perform(ActionMapping mapping,
                 ActionForm form,
                 HttpServletRequest request,
                 HttpServletResponse response)
    throws IOException, ServletException {

        return mapping.findForward("success");  
    }

}
-----END ContentAction.java------

The output I get (Struts 1.1b2/Tomcat 4.1.12)
[Exception in:/header.do] Cannot forward after response has been committed   
[Exception in:/content.do] Cannot forward after response has been committed  

Thanks for any help/suggestions! 

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message