For implementing the common logic in jsps

Discussions

Web tier: servlets, JSP, Web frameworks: For implementing the common logic in jsps

  1. For implementing the common logic in jsps (2 messages)

    Hi,

    For implementing a the common logic in all the jsps in a web application.

    Is there anyway to specify in jsps to extend from some common servlet/javax.servlet.jsp.HttpJspPage.

    Any info regarding the same will be of grate help.

    Thanks,
    Siva

    Threaded Messages (2)

  2. You can write the common logic in functions in one or more .js files and then include the .js files in rest of your JSPs
  3. Logic reuse in JSP files[ Go to top ]

    You may want to look at using something like the Tiles mechanism that is part of the Struts framework.
    (There are other alternatives but, as I'm not familiar with them, I'll leave the description these to somebody else)

    Whether is based purely on JSP files or a combination of servlets and JSPs, you'll gain a great deal of re-use from adding Tiles support.

    There are lots of tutorials on the web, a notable example being a sample chapter from a Ted Husted (Very active figure on this subject) book. http://www.manning-source.com/books/husted/husted_ch11.pdf

    Give it try - I'm sure you'll like it.