struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Re: (newbie asking advice) in which order do I call my .do and .jsp?
Date Fri, 21 Nov 2003 18:56:34 GMT
Janice wrote:

> (1) When I want to display a list of widgets, my link is to:
> /
> (2) My mapping looks like this (ProjectTypeCodeActions extends
> DispatchAction):
>     <action    path="/projectTypes"
>                input="/projectTypeCode/project_type_code_form.jsp"
>                parameter="action"
>                scope="request"
>                type="projectTypeCode.ProjectTypeCodeActions"
>                validate="false">
>       <forward name="form"
> path="/projectTypeCode/project_type_code_form.jsp" />
>       <forward name="list"
> path="/projectTypeCode/project_type_code_list.jsp" />
>       <forward name="failure" path="/common/error.html" />
>     </action>
> (3) So it goes off to the DB to get my list, and then forwards off to
> project_type_code_list.jsp, which contains:
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <tiles:insert page="../layouts/PPELayout.jsp">
>   <tiles:put name="menuLinks" value="../common/menu.jsp" />
>   <tiles:put name="mainBody"
> value="../projectTypeCode/project_type_code_list_body.jsp" />
> </tiles:insert>

I could be misunderstanding what you are trying to accomplish, but I 
think you are not utilizing the true benefit of tiles. In the example 
above it looks like you want an action to get you a List of project type 
codes and then display them(?).  Normally using tiles, the benefit would 
be that you would only have to code the actual 
"project_type_code_list.jsp"   which would just be the simple loop of 
the list and display the output. The layout portion (which you seem to 
defining in the project_type_code_list.jsp) is set up elsewhere as a 
definition that would use a base layout that all of your pages could use...

For example you'd define a main *layout.jsp* page that might look like...

<%@ taglib uri="tiles" prefix="tiles" %>
<!-- possibly other tag imports -->
<head><title><tiles:getAsString name='title'/></title></head>
   <td><tiles:insert attribute='menu'/></td>
   <td><tiles:insert attribute='content'/></td>

Then in your *tiles-def.xml* file you might have:

<definition name="BaseDef" template="layout.jsp">
         <put name="title"               value="${title}"/>
         <put name="menu"                value="yourMenu.jsp"/>
         <put name="content"             value="${content}"/>

<!-- your definitions can extend the one above -->
<definition name="" extends ="BaseDef">
         <put name="title" value="Project Codes List"/>
         <put name="content" value="productCodes.jsp"/>

Your productCodes.jsp:

A JSP where you display the List you are getting in your Action

Your Action:

<action  path="/projectTypes"
       <forward name="form" path="" />
       <forward name="failure" path="" />
       <!-- this is the tile just made above -->
       <forward name="list" path="" />


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message