You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mary Remillard <ma...@eidria.com> on 2003/10/15 04:27:36 UTC

Re: ezmlm response

Hi I'm new to Struts and Tiles and I'm having a problem getting 
the Action class to be instantiated and it's execute method
called when I use a tile definition under certain circumstances. 
I need the execute method called in both cases since I need to 
prepopulate the form

Case that works
---------------
When tile definition is processed using link action in a jsp
<html:link action="/common/customerDetail">
    <bean:write name = "listForm" property="valueByIndex"/>
</html:link>

I see this in the log that /common/customerDetail is processed
by org.apache.struts.tiles.TileRequestProcess as definition
'.layout.customerDetail'. It then goes on to look up the ActionBean,
look up the Action instance for the class and calls that Action
instances execute() method. Which is exactly what I want.

Case that doesn't work
----------------------
But when the tile definition is processed using the ActionForward
returned from  Action.execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)

I see in the log that it's just inserting the page and not looking
up the Action instance class and calling the execute method:

    2003-10-14 17:01:27,366 [Thread-4] DEBUG 
        org.apache.struts.taglib.tiles.InsertTag  
        - insert page='/common/customerList.jsp'.

How can I get the execute method to be called in the 2nd case? Thanks
for the help.

------------------------------------------------------------------------
tile definition xml snippet

<tiles-definitions>
    <definition name=".layout.base" path="/common/layout.jsp">
      <put name="title" value ="${title}"/>
      <put name="heading" value="${heading}"/>
      <put name="menu" value="${menu}"/>
      <put name="header" value="/common/header.jsp"/>
      <put name="content" value="${content}"/>
      <put name="footer" value="/common/footer.jsp"/>
   </definition>

    <definition name=".layout.customerList" extends=".layout.base">
      <put name="title" value ="customerList.title"/>
      <put name="heading" value="customerList.heading"/>
      <put name="menu" value="/common/menu.jsp"/>
      <put name="content" value="/common/customerList.jsp"/>
      <put name="tableHeading" value="customerList.table.heading"/>
   </definition>

    <definition name=".layout.customerDetail" extends=".layout.base">
      <put name="title" value ="customerDetail.title"/>
      <put name="heading" value="customerDetail.heading"/>
      <put name="menu" value="/common/menu.jsp"/>
      <put name="content" value="/common/customerDetail.jsp"/>
   </definition>

------------------------------------------------------------------------
 struts-config.xml file snippet

    <form-beans>
        <form-bean name="mapForm" 
                   type="com.eidria.common.forms.EDAMapForm">
        </form-bean>

        <form-bean name="listForm" 
                   type="com.eidria.common.forms.EDAListForm">
        </form-bean>
    </form-beans>

        <!-- Display Customer list-->
        <action path="/common/customerList"
                type="com.eidria.common.actions.EDAListAction"
                name="listForm"
                scope="request"
                parameter="customerNames" >
                <forward name="success" path=".layout.customerList" />
                <forward name="add" path=".layout.customerDetail"/>
                <forward name="previous" path=".layout.homePage"/>
        </action>

        <!-- Customer Detail -->
        <action path="/common/customerDetail"
                type="com.eidria.common.actions.EDADetailAction"
                name="mapForm"
                scope="request"
                parameter="customer" 
                input=".layout.customerDetail">
        <forward name="continue" path=".layout.customerDetail"/>
        <forward name="success" path=".layout.customerList"/>
        </action>

------------------------------------------------------------------------
layout.jsp snippet for using definition

<!-- Now insert the jsp that has all the fun stuff -->
<tiles:insert attribute="content"/>



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