tags:

views:

354

answers:

1

Please help clarifying :

In web.xml I have the following

<jsp-config>
    <jsp-property-group>
      <url-pattern>*.jsp</url-pattern>
      <el-ignored>false</el-ignored>
      <page-encoding>utf-8</page-encoding>
      <include-prelude>/jstlTaglibs.jspf</include-prelude>
    </jsp-property-group>
</jsp-config>

Also in decorators.xml I have

<decorator name="footer" page="footer.jsp">
    <pattern>*.action</pattern>
</decorator>

which is used via sitemesh.xml. The footer.jsp which says

...
<decorator:body />
<@include .. "footer.jsp"/>

So what I gather is, both of the codes above in a sense inject some jspf. Please help highlighting the differences and benefits of both the approaches. Also which one is more used across industry ?

+2  A: 

The JSP include-prelude is used to inject a snippet of jsp at the beginning of each jsp page. This could be used in a pure jsp environment to avoid writing the same code on each page. The code that is injected is executed as jsp.

Sitemesh on the other hand does not depend on a jsp environment and does a more static formatting of the html response. That is sitemesh has no idea where the html code is coming from, it could be a static html page, PHP or JSP or otherwise. It simply takes the HTML code and formats it according to your template and sends it on its way.

So both techniques may be used together because they handle different aspects of the response process.

Vincent Ramdhanie