Re: Templates: a design question
In my mind it's a cleaner separation to do it with multiple files. The page(s) responsible for the content can focus exclusively on that content, and the page responsible for laying out the template (i.e. putting the named content elements in place) can focus on that. It ends up being very easy to maintain this way. This is especially true in the case where your template defines multiple non-direct named content elements. In my example you can develop these elements of content as reusable components... To be honest, I had never even given your suggestion any thought. I imagine there may be situations where this would be extremely convenient, and as long as it works I'd say do it if it fits your needs... Troy - Original Message - From: Erik Hatcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 02, 2001 12:46 AM Subject: Re: Templates: a design question 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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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.
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.
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 [EMAIL PROTECTED] To: [EMAIL PROTECTED] 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.
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. 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 +1 Heh heh - we even use the same naming convention pagename.jsp + pagename_content.jsp. One little issue we've run across is when the Designer wants to display something dynamically in the MainLayout.jsp based on conditions/stuff happening in the content.jsp. Cheers, Tim