struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <>
Subject Re: Templates: a design question
Date Thu, 02 Aug 2001 06:46:21 GMT

Why have two pages for each page that uses templates rather than collapse
them into a single page with the content embedded like this:

    <template:put name="content" direct="true">
        content here

By having two pages, don't you end up with one page having the page title,
and the other with the content as well as possibly other things separated?


----- Original Message -----
From: "troy hart" <>
To: <>
Sent: Wednesday, August 01, 2001 9:25 AM
Subject: Re: Templates: a design question

> The approach I use (and I believe it is a common approach) is to have two
> jsp pages for each page on my site that is going to use templates. For
> example, if I have an ecommerce site it is likely I will have a shopping
> cart page, a search page and a search results pages... For this example,
> set of jsp pages would be as follows:
> MainLayout.jsp - the main template layout page.
> ShopCart_content.jsp - the actual content of the shopping card page.
> ShopCart.jsp - the shopping cart page that references MainLayout.jsp and
> tells it to use ShopCart_content.jsp...
> Search_content.jsp - the actual content of the search page.
> Search.jsp - the search page that references MainLayout.jsp and tells it
> use Search_content.jsp...
> SearchResults_content.jsp - the actual content of the search results page.
> SearchResults.jsp - the search results page that references MainLayout.jsp
> and tells it to use SearchResults_content.jsp...
> This way your action mappings reference ShopCart.jsp, Search.jsp, and
> SearchResults.jsp...
> Hope this helps,
> Troy
> ----- Original Message -----
> From: "Oleg Bondarenko" <>
> To: <>
> Sent: Wednesday, August 01, 2001 10:57 AM
> Subject: Templates: a design question
> Hello all,
> I am very new to Struts and I find it interesting. I like the action
> and also templates, but I have difficulties using them together.
> E.g. I have a central page, say Main.jsp that has a template which
> constant header and footer and a variable content part. This content part
> jsp) must be determined at the run-time. Because of the template I have to
> always send back to the user the Main.jsp. How to use action mapping then?
> One possible solution would be the following. The action handler stores
> variable content part as a session attribute and always returns the global
> mapping "main" (which is mapped to the Main.jsp). The Main.jsp retrieves
> central variable part from the session and pass it to the template.
> This works, but I have a feeling that I am not correctly using the Struts.
> Any input from experts would be highly appreciated.
> Best Regards,
> Oleg Bondarenko
> --
> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
> irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail ist nicht gestattet.
> This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy this e-mail. Any
> unauthorised copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.

View raw message