Skip to content

hazendaz/sitemesh2

 
 

Repository files navigation

[NOTICE] The original sitemesh 2.x line was entirely dormant and dead as replaced by version 3. This project is heavily used in psi-probe project and it was not understood how to even upgrade to sitemesh 3. Due to need to get to jakarta, an effort to bring this back to life was performed. Shortly after the original sitemesh team started work again. There was hope to bring this together but they moved to gradle. Further, the changes done here were significant on cleanup. So merging between is no longer possible. Most everything is the same but there are some differences as noted on our open issues here. Its fine I think to use either original or this fork. Psi probe will continue using this fork as no reason to migrate back given some key performance improvements and modernization here.


** OpenSymphony SiteMesh 2.5.0 **


SiteMesh is a web-page layout system that can be used to abstract common look and feel from the functionality of a web-application and to assemble large webpages from smaller components. Pages and components can have meta-data extracted from them (such as body, title and meta-tags) which can be used by decorators (skins) that are applied.

SiteMesh won't tread on your toes or force you to work in a certain way (except for cleaner) - you install and carry on working as before. It seamlessly fits in with existing frameworks.

Forget the hype - just try it! You'll be impressed with how it can simplify things.


-- Requirements --

SiteMesh requires a Java Servlet container conforming to the Servlet 2.3 specification. Versions prior to 2.3 are not enough.

Currently known containers that support this and SiteMesh was tested with:


-- Installation --

  • Copy sitemesh-.jar to the WEB-INF/lib/ directory of your web-app.

  • OPTIONAL: Copy sitemesh.xml to the WEB-INF/ directory if you need to specify a custom decorator mapper configuration then the default configuration.

  • Add the following to WEB-INF/web.xml:

    sitemesh com.opensymphony.sitemesh.webapp.SiteMeshFilter sitemesh /*
  • ORION USERS ONLY. For performance reasons, Orion does not auto-load tab library descriptors from Jars by default. To get passed this you will also have to copy sitemesh-decorator.tld and sitemesh-page.tld to WEB-INF/lib and add the following to WEB-INF/web.xml:

    http://www.opensymphony.com/sitemesh/decorator /WEB-INF/lib/sitemesh-decorator.tld http://www.opensymphony.com/sitemesh/page /WEB-INF/lib/sitemesh-page.tld

-- Getting started --

Ok, let's assume you have some basic JSPs already on the site. These should contain vanilla HTML.

If you don't, here's a JSP to get you started (test.jsp).

<html>
    <head>
        <title>Hello world</title>
    </head>
    <body>
        <p>Today is <%= new java.util.Date() %>.</p>
    </body>
</html>

Once you have some content (preferably more imaginative than the example above), a decorator should be created (decorator.jsp).

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<html>
    <head>
        <title>My Site - <decorator:title default="Welcome!" /></title>
        <decorator:head />
    </head>
    <body>
        <decorator:body />
    </body>
</html>

Now you need tell SiteMesh about that decorator and when to use it. Create the file WEB-INF/decorators.xml:

<decorators>

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

</decorators>

Access your original JSP (test.jsp) though your web-browser and it should look pretty normal. Now if you add some styling to your decorator it shall automatically be applied to all the other pages in your web-app.

You can define as many decorators as you want in decorators.xml. Example:

<decorators defaultdir="/decorators">

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

    <decorator name="anotherdecorator" page="decorator2.jsp">
        <pattern>/subdir/*</pattern>
    </decorator>

    <decorator name="htmldecorator" page="html.jsp">
        <pattern>*.html</pattern>
        <pattern>*.htm</pattern>
    </decorator>

    <decorator name="none">
        <!-- These files will not get decorated. -->
        <pattern>/anotherdir/*</pattern>
    </decorator>

</decorators>

-- Further support --

You get the idea. Play around. See the SiteMesh website for full documentation.

http://www.opensymphony.com/sitemesh/

-- Credits --

Thank these guys:

Packages

No packages published

Languages

  • Java 97.2%
  • HTML 1.7%
  • Other 1.1%