struts-user mailing list archives

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

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
    </template:put>

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?

    Erik

----- Original Message -----
From: "troy hart" <thart@part.net>
To: <struts-user@jakarta.apache.org>
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,
the
> 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
to
> 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" <oleg.bondarenko@emagine.de>
> To: <struts-user@jakarta.apache.org>
> 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
mapping
> 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
contains
> constant header and footer and a variable content part. This content part
(a
> 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
the
> 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
the
> 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.
>
>
>


Mime
View raw message