Hi,
I want one solution for pages which have common view.
For example in some systems we have some pages that
have one table , some button , one title, ..
Title
Buttons
Tables
Buttons
Messages
End
I want solution to reduce or remove many JSP's that have
similar code.
Thanks
Amir
-
Solution for common view pages (7 messages)
- Posted by: amir taherkordi
- Posted on: July 13 2002 11:47 EDT
Threaded Messages (7)
- Solution for common view pages by Greg Jones on July 15 2002 00:27 EDT
- Solution for common view pages by amir taherkordi on July 15 2002 10:34 EDT
-
Solution for common view pages by Adnane KASSAMALY on July 16 2002 08:05 EDT
-
Solution for common view pages by Colin Cassidy on July 16 2002 09:36 EDT
-
Solution for common view pages by Raj Rajen on July 17 2002 03:36 EDT
- Solution for common view pages by Andy Bowes on July 18 2002 05:22 EDT
-
Solution for common view pages by Raj Rajen on July 17 2002 03:36 EDT
-
Solution for common view pages by Colin Cassidy on July 16 2002 09:36 EDT
-
Solution for common view pages by Adnane KASSAMALY on July 16 2002 08:05 EDT
- Solution for common view pages by amir taherkordi on July 15 2002 10:34 EDT
- Solution for common view pages by Naresh Tirunagari on July 17 2002 12:26 EDT
-
Solution for common view pages[ Go to top ]
- Posted by: Greg Jones
- Posted on: July 15 2002 00:27 EDT
- in response to amir taherkordi
Have you looked into XSL? -
Solution for common view pages[ Go to top ]
- Posted by: amir taherkordi
- Posted on: July 15 2002 10:34 EDT
- in response to Greg Jones
Hi,
no, I want better solution.
I guess that XSL is for applications that have multiple device or client, for example for wireless, web, etc.
But I have one type : Web Client
And with multiple pages which have similar view.
For example all of them have one title.
all of them have some tables.
all of them have some button after previous tables.
so I want solution to reduce my jsp's.
thanks
Amir
-
Solution for common view pages[ Go to top ]
- Posted by: Adnane KASSAMALY
- Posted on: July 16 2002 08:05 EDT
- in response to amir taherkordi
Try to use includes. -
Solution for common view pages[ Go to top ]
- Posted by: Colin Cassidy
- Posted on: July 16 2002 09:36 EDT
- in response to Adnane KASSAMALY
There are three concepts that need to be identified here:
Page Layout - breaking up the page into regions and separating the contents of those regions from the layout code.
Region Content - the definition of what goes into those regions for a particular page.
A Page - the combination of a page layout and a set of region content that constitutes a concrete view of the system.
Region Content that is shared between pages may easily be isolated into separate JSP files (or a servlet) and included by the Page Layout JSP. This reduces redundancy in the Region Content, but if the 'include' is hard coded then it is not possible to share page layouts between pages. This leads to high cost of maintenance and potential for inconsistent layout between pages.
The solution is to separate the concepts of Page and Page Layout - possibly by using another include. The Page is then responsible for identifying both the Page Layout *and* the Page Content. To implement this, the Page Layout will need to be parameterised in some way or delegate the page inclusion to a central Region Content dispatcher.
Although none of this is particularly complicated, there are other common issues such as centralised flow control and validation that will lead you down the path of developing an application framework. This is not a trival undertaking and I would recommend the selection of a pre-built framework such as the Struts/Tiles combination.
Colin. -
Solution for common view pages[ Go to top ]
- Posted by: Raj Rajen
- Posted on: July 17 2002 15:36 EDT
- in response to Colin Cassidy
I agree with Colin's remark about this being not a trivial effort. Amir, take a look at the following articles by David Geary:
http://www.javaworld.com/javaworld/jw-09-2000/jw-0915-jspweb_p.html
http://www.javaworld.com/javaworld/jw-12-2001/jw-1228-jsptemplate_p.html
I think it has the relevant information you are seeking. Alternatively, take a look at the book "Advanced JavaServer Pages" by the same author. Struts/Tiles is a good way to go as well.
Hope that helps
Raj -
Solution for common view pages[ Go to top ]
- Posted by: Andy Bowes
- Posted on: July 18 2002 05:22 EDT
- in response to Raj Rajen
I have been very impressed by the implementation of 'Templates' in Struts. IMO in is one of the most underused sections of the Struts package.
Struts Templates allow you to define a consistent page layout across multiple JSP pages ( A bit like standard HTML frames but without the obvious drawbacks :) ). Effectively you split your layout up using HTML tables and can then place content in the named sections of the template.
This is very effective when you use it with JSP includes to place standard title bars, navigation, footers etc into your JSP pages.
HTH
-
Solution for common view pages[ Go to top ]
- Posted by: Naresh Tirunagari
- Posted on: July 17 2002 12:26 EDT
- in response to amir taherkordi
Hi
I can suggest u a feasible solution.
For the common code create new jsps and include them in the main jsps.
For instance,
put the title code in a new jsp called title.jsp and include in the required jsp's.
similarily for disclaimer ie., end, create another new jsp called footer.jsp and include it in the required jsp's.
Follow alike for others.
Naresh