Solution for common view pages


XML & Web services: Solution for common view pages

  1. Solution for common view pages (7 messages)


    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, ..


    I want solution to reduce or remove many JSP's that have
    similar code.




    Threaded Messages (7)

  2. Solution for common view pages[ Go to top ]

    Have you looked into XSL?
  3. Solution for common view pages[ Go to top ]


    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.


  4. Try to use includes.
  5. 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.

  6. Solution for common view pages[ Go to top ]

    I agree with Colin's remark about this being not a trivial effort. Amir, take a look at the following articles by David Geary:

    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
  7. Solution for common view pages[ Go to top ]

    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.

  8. 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.