Re: Struts-Tiles Design question
Dharmendra, Honestly, I can't think of a better way to do this than what you describe below. However, you could use extension to streamline it a bit... This is your main "wrapper" tile: This is your content "wrapper" tile: Here's your main and content tiles for edit: Here's your main and content tiles for view: I think you could streamline even further by making the 5 sections named sections instead: In your tiles wrapper jsp you would have statements like the following: Then you extend dish.content.main to create edit, add, etc. This way your extended tiles don't have to include things that don't change between functions, like maybe he picture. If your current setup is what I think it is you can change the layout by simply changing the number of columns. My suggestion would remove that feature, but it would potentially reduce your tiles-defs file complexity. Personally, I'd lose the column layout thing and just put everything in one tile for add, one for edit, etc. and include appropriate tiles in your JSP. Greg On Sep 1, 2005, at 9:40 AM, [EMAIL PROTECTED] wrote: Hi, Just a follow question to a similar scenario, what's the recomended approach with Struts-Tiles to handle the different modes in which a JSP may be displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple sections. e.g. Dish.jsp which can be composed of multiple sections, such as summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp Here are the approaches I can think of:- 1. Tile Definition say "dish.content" which has all the JSPs inserts for the "dish.jsp" page, and each section's (summary/ picture/ingredients/preparation/cost) JSP expectinig some request attribute say "mode" to determine how to display that individual section in Add or Edit or View mode. And say in the "DishAction" class doing the forward to the tiles definition say "main.dish" and passing the request attribute say "mode" having value "edit", "view" and so on... 2. Having the JSP pages for each section split further as separate JSPs for each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using multiple tile definitions having the same layout!!! such as below:- And the having the "DishAction" class forward to appropriate tiles definition "main.dish.edit" or "main.dish.view"..but in this case we are duplicating the Tile definitions even though the page layout is exactly the same!!! Any thoughts/comments/suggestions are most welcome. Thanks in advance!, Regards, Dharmendra ps: have a good day! -----Original Message- From: Michael Rasmussen [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 11:37 AM To: Struts Users Mailing List Subject: Re: Struts-Tiles Design question Dilip, The tiles controller sounds like an interesting way to do it, but I have never used it. I agree with Nels that you should stay away from a JSP implementation of this. I have stretched tiles pretty far as to what it can do conditionally, and I have been very happy with it. I would suggest using an action to make decisions about where to go, and use tiles templates to put the right fragments in the right places. Michael On 8/25/05, Nels Overgaard-Cook <[EMAIL PROTECTED]> wrote: If you put the business logic in the JSPs, then it seems to me that you're essentially mixing the business and presentation layers. I would put the business login in an action and figure out which tile to forward to from there. Of course, I haven't used the Tiles Controller that Greg suggested... Nels On 8/25/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: I have an application built on struts and tiles. I have a design question and would like some of your valuable opinions. I have a huge jsp, which is broken into many includes, say abc.jsp and includes one.jsp, two.jsp etc. As, I mentioned I use tiles so in the config file, I have a forward element, which is like this The "abc" is defined in the tiles as Now for the design question... I am going to have to switch the includes (o
RE: Struts-Tiles Design question
Hi, Just a follow question to a similar scenario, what's the recomended approach with Struts-Tiles to handle the different modes in which a JSP may be displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple sections. e.g. Dish.jsp which can be composed of multiple sections, such as summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp Here are the approaches I can think of:- 1. Tile Definition say "dish.content" which has all the JSPs inserts for the "dish.jsp" page, and each section's (summary/picture/ingredients/preparation/cost) JSP expectinig some request attribute say "mode" to determine how to display that individual section in Add or Edit or View mode. And say in the "DishAction" class doing the forward to the tiles definition say "main.dish" and passing the request attribute say "mode" having value "edit", "view" and so on... 2. Having the JSP pages for each section split further as separate JSPs for each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using multiple tile definitions having the same layout!!! such as below:- And the having the "DishAction" class forward to appropriate tiles definition "main.dish.edit" or "main.dish.view"..but in this case we are duplicating the Tile definitions even though the page layout is exactly the same!!! Any thoughts/comments/suggestions are most welcome. Thanks in advance!, Regards, Dharmendra ps: have a good day! -Original Message- From: Michael Rasmussen [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 11:37 AM To: Struts Users Mailing List Subject: Re: Struts-Tiles Design question Dilip, The tiles controller sounds like an interesting way to do it, but I have never used it. I agree with Nels that you should stay away from a JSP implementation of this. I have stretched tiles pretty far as to what it can do conditionally, and I have been very happy with it. I would suggest using an action to make decisions about where to go, and use tiles templates to put the right fragments in the right places. Michael On 8/25/05, Nels Overgaard-Cook <[EMAIL PROTECTED]> wrote: > If you put the business logic in the JSPs, then it seems to me that you're > essentially mixing the business and presentation layers. I would put the > business login in an action and figure out which tile to forward to from > there. Of course, I haven't used the Tiles Controller that Greg suggested... > > Nels > > On 8/25/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > > > > I have an application built on struts and tiles. I have a design question > > and would like some of your valuable opinions. > > > > I have a huge jsp, which is broken into many includes, say abc.jsp and > > includes one.jsp, two.jsp etc. > > As, I mentioned I use tiles so in the config file, I have a forward > > element, > > which is like this > > > > > > The "abc" is defined in the tiles as > > > > > > Now for the design question... > > I am going to have to switch the includes (one.jsp, two.jsp etc) based on > > some business rules like the geographical area, app type etc. > > > > 1) Should I just put this logic in the jsp (using if statements like :if > > apptype = "A" use one.jsp else use one-next.jsp etc) or > > 2)Should I use tiles by having different action mappings based on > > different > > business parameters(say app type) and have each mapping forward to a > > different "forward" defined in tiles-def. > > > > Also the business parameters (based on which jsp is selected) may change > > in > > the future. > > > > Thanks for your input > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not t
RE: Struts-Tiles Design question
Hi, Just a follow question to a similar scenario, what's the recomended approach with Struts-Tiles to handle the different modes in which a JSP may be displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple sections. e.g. Dish.jsp which can be composed of multiple sections, such as summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp Here are the approaches I can think of:- 1. Tile Definition say "dish.content" which has all the JSPs inserts for the "dish.jsp" page, and each section's (summary/picture/ingredients/preparation/cost) JSP expectinig some request attribute say "mode" to determine how to display that individual section in Add or Edit or View mode. And say in the "DishAction" class doing the forward to the tiles definition say "main.dish" and passing the request attribute say "mode" having value "edit", "view" and so on... 2. Having the JSP pages for each section split further as separate JSPs for each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using multiple tile definitions having the same layout!!! such as below:- And the having the "DishAction" class forward to appropriate tiles definition "main.dish.edit" or "main.dish.view"..but in this case we are duplicating the Tile definitions even though the page layout is exactly the same!!! Any thoughts/comments/suggestions are most welcome. Thanks in advance!, Regards, Dharmendra ps: have a good day! -Original Message- From: Michael Rasmussen [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 11:37 AM To: Struts Users Mailing List Subject: Re: Struts-Tiles Design question Dilip, The tiles controller sounds like an interesting way to do it, but I have never used it. I agree with Nels that you should stay away from a JSP implementation of this. I have stretched tiles pretty far as to what it can do conditionally, and I have been very happy with it. I would suggest using an action to make decisions about where to go, and use tiles templates to put the right fragments in the right places. Michael On 8/25/05, Nels Overgaard-Cook <[EMAIL PROTECTED]> wrote: > If you put the business logic in the JSPs, then it seems to me that you're > essentially mixing the business and presentation layers. I would put the > business login in an action and figure out which tile to forward to from > there. Of course, I haven't used the Tiles Controller that Greg suggested... > > Nels > > On 8/25/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > > > > I have an application built on struts and tiles. I have a design question > > and would like some of your valuable opinions. > > > > I have a huge jsp, which is broken into many includes, say abc.jsp and > > includes one.jsp, two.jsp etc. > > As, I mentioned I use tiles so in the config file, I have a forward > > element, > > which is like this > > > > > > The "abc" is defined in the tiles as > > > > > > Now for the design question... > > I am going to have to switch the includes (one.jsp, two.jsp etc) based on > > some business rules like the geographical area, app type etc. > > > > 1) Should I just put this logic in the jsp (using if statements like :if > > apptype = "A" use one.jsp else use one-next.jsp etc) or > > 2)Should I use tiles by having different action mappings based on > > different > > business parameters(say app type) and have each mapping forward to a > > different "forward" defined in tiles-def. > > > > Also the business parameters (based on which jsp is selected) may change > > in > > the future. > > > > Thanks for your input > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not t
RE: Struts-Tiles Design question
Hi, Just a follow question to a similar scenario, what's the recomended approach with Struts-Tiles to handle the different modes in which a JSP may be displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple sections. e.g. Dish.jsp which can be composed of multiple sections, such as summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp Here are the approaches I can think of:- 1. Tile Definition say "dish.content" which has all the JSPs inserts for the "dish.jsp" page, and each section's (summary/picture/ingredients/preparation/cost) JSP expectinig some request attribute say "mode" to determine how to display that individual section in Add or Edit or View mode. And say in the "DishAction" class doing the forward to the tiles definition say "main.dish" and passing the request attribute say "mode" having value "edit", "view" and so on... 2. Having the JSP pages for each section split further as separate JSPs for each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using multiple tile definitions having the same layout!!! such as below:- And the having the "DishAction" class forward to appropriate tiles definition "main.dish.edit" or "main.dish.view"..but in this case we are duplicating the Tile definitions even though the page layout is exactly the same!!! Any thoughts/comments/suggestions are most welcome. Thanks in advance!, Regards, Dharmendra ps: have a good day! -Original Message- From: Michael Rasmussen [mailto:[EMAIL PROTECTED] Sent: Friday, August 26, 2005 11:37 AM To: Struts Users Mailing List Subject: Re: Struts-Tiles Design question Dilip, The tiles controller sounds like an interesting way to do it, but I have never used it. I agree with Nels that you should stay away from a JSP implementation of this. I have stretched tiles pretty far as to what it can do conditionally, and I have been very happy with it. I would suggest using an action to make decisions about where to go, and use tiles templates to put the right fragments in the right places. Michael On 8/25/05, Nels Overgaard-Cook <[EMAIL PROTECTED]> wrote: > If you put the business logic in the JSPs, then it seems to me that you're > essentially mixing the business and presentation layers. I would put the > business login in an action and figure out which tile to forward to from > there. Of course, I haven't used the Tiles Controller that Greg suggested... > > Nels > > On 8/25/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > > > > I have an application built on struts and tiles. I have a design question > > and would like some of your valuable opinions. > > > > I have a huge jsp, which is broken into many includes, say abc.jsp and > > includes one.jsp, two.jsp etc. > > As, I mentioned I use tiles so in the config file, I have a forward > > element, > > which is like this > > > > > > The "abc" is defined in the tiles as > > > > > > Now for the design question... > > I am going to have to switch the includes (one.jsp, two.jsp etc) based on > > some business rules like the geographical area, app type etc. > > > > 1) Should I just put this logic in the jsp (using if statements like :if > > apptype = "A" use one.jsp else use one-next.jsp etc) or > > 2)Should I use tiles by having different action mappings based on > > different > > business parameters(say app type) and have each mapping forward to a > > different "forward" defined in tiles-def. > > > > Also the business parameters (based on which jsp is selected) may change > > in > > the future. > > > > Thanks for your input > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not t
Re: Struts-Tiles Design question
Dilip, The tiles controller sounds like an interesting way to do it, but I have never used it. I agree with Nels that you should stay away from a JSP implementation of this. I have stretched tiles pretty far as to what it can do conditionally, and I have been very happy with it. I would suggest using an action to make decisions about where to go, and use tiles templates to put the right fragments in the right places. Michael On 8/25/05, Nels Overgaard-Cook <[EMAIL PROTECTED]> wrote: > If you put the business logic in the JSPs, then it seems to me that you're > essentially mixing the business and presentation layers. I would put the > business login in an action and figure out which tile to forward to from > there. Of course, I haven't used the Tiles Controller that Greg suggested... > > Nels > > On 8/25/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > > > > I have an application built on struts and tiles. I have a design question > > and would like some of your valuable opinions. > > > > I have a huge jsp, which is broken into many includes, say abc.jsp and > > includes one.jsp, two.jsp etc. > > As, I mentioned I use tiles so in the config file, I have a forward > > element, > > which is like this > > > > > > The "abc" is defined in the tiles as > > > > > > Now for the design question... > > I am going to have to switch the includes (one.jsp, two.jsp etc) based on > > some business rules like the geographical area, app type etc. > > > > 1) Should I just put this logic in the jsp (using if statements like :if > > apptype = "A" use one.jsp else use one-next.jsp etc) or > > 2)Should I use tiles by having different action mappings based on > > different > > business parameters(say app type) and have each mapping forward to a > > different "forward" defined in tiles-def. > > > > Also the business parameters (based on which jsp is selected) may change > > in > > the future. > > > > Thanks for your input > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts-Tiles Design question
If you put the business logic in the JSPs, then it seems to me that you're essentially mixing the business and presentation layers. I would put the business login in an action and figure out which tile to forward to from there. Of course, I haven't used the Tiles Controller that Greg suggested... Nels On 8/25/05, Dilip Ladhani <[EMAIL PROTECTED]> wrote: > > I have an application built on struts and tiles. I have a design question > and would like some of your valuable opinions. > > I have a huge jsp, which is broken into many includes, say abc.jsp and > includes one.jsp, two.jsp etc. > As, I mentioned I use tiles so in the config file, I have a forward > element, > which is like this > > > The "abc" is defined in the tiles as > > > Now for the design question... > I am going to have to switch the includes (one.jsp, two.jsp etc) based on > some business rules like the geographical area, app type etc. > > 1) Should I just put this logic in the jsp (using if statements like :if > apptype = "A" use one.jsp else use one-next.jsp etc) or > 2)Should I use tiles by having different action mappings based on > different > business parameters(say app type) and have each mapping forward to a > different "forward" defined in tiles-def. > > Also the business parameters (based on which jsp is selected) may change > in > the future. > > Thanks for your input > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Struts-Tiles Design question
On Aug 25, 2005, at 3:15 PM, Dilip Ladhani wrote: I have an application built on struts and tiles. I have a design question and would like some of your valuable opinions. I have a huge jsp, which is broken into many includes, say abc.jsp and includes one.jsp, two.jsp etc. As, I mentioned I use tiles so in the config file, I have a forward element, which is like this The "abc" is defined in the tiles as Now for the design question... I am going to have to switch the includes (one.jsp, two.jsp etc) based on some business rules like the geographical area, app type etc. 1) Should I just put this logic in the jsp (using if statements like :if apptype = "A" use one.jsp else use one-next.jsp etc) or You should probably stay away from this if possible. Have you looked at the Tiles Controller interface? You might be able to put your business logic in a controller class. The ComponentContext is passed into the controller and you can set attribute values, etc. Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts-Tiles Design question
I have an application built on struts and tiles. I have a design question and would like some of your valuable opinions. I have a huge jsp, which is broken into many includes, say abc.jsp and includes one.jsp, two.jsp etc. As, I mentioned I use tiles so in the config file, I have a forward element, which is like this The "abc" is defined in the tiles as Now for the design question... I am going to have to switch the includes (one.jsp, two.jsp etc) based on some business rules like the geographical area, app type etc. 1) Should I just put this logic in the jsp (using if statements like :if apptype = "A" use one.jsp else use one-next.jsp etc) or 2)Should I use tiles by having different action mappings based on different business parameters(say app type) and have each mapping forward to a different "forward" defined in tiles-def. Also the business parameters (based on which jsp is selected) may change in the future. Thanks for your input - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]