You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

The following document illustrates how to get started writing a web application using common code that we have been using or developing over the last few years. We also describe how to deploy the application to a web server.

Web Application Skeleton

Download end extract the following zip file containing a skeleton for your new web application.

Sitemesh

Sitemesh is used to decorate the pages, making sure they all get a similar look and feel. Please refer to the sitemesh documentation for more information.

The main sitemesh related files are the following:

  • src/webapp/WEB-INF/sitemesh.xml Sitemes configuration file in which appropriate modules are loaded to handle frames.
  • src/webapp/WEB-INF/decorators.xml This is the mapping between your jsp pages and the templates to be used to decorate them. In this example we map all the pages to a common decorator, but for three pages belonging to a frame which need to have special decorators. The following are the decorators used:
    • src/webapp/decorators/basicDecorator.jsp common decorator for all pages. It adds a common style sheed from the GLAST commons, a style sheet specifit to this application (src/webapp/css/style.css), it adds the logo on the top right of the page, the login button and the footer with the last modified date.
    • src/webapp/decorators/justFooterDecorator.jsp decorator that just adds the footer, used for the main window of frames. It adds the last modified date at the bottom of the page.
    • src/webapp/decorators/justHeaderDecorator.jsp decorator that just decorates the header with the logo and the login button. This is used for the header of a frame.
    • src/webapp/decorators/justStyleDecorator.jsp decorator that just adds style sheets. Used for the menu/tree window of a frame.

The above decorators share common code stored in the form of tag files:

  • src/webapp/WEB-INF/tags/decorators/footerDecorator.tag Prints the last modified date in the footer.
  • src/webapp/WEB-INF/tags/decorators/headerDecorator.tag Adds the logo and the login button to the header.

Finally for sitemesh to work a filter needs to be added to the application. It's the filter that is responsible for mangling your jsp code with the decorating templates. This is done in src/webapp/WEB-INF/web.xml with the following code:

    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

If you are not interested in sitemesh you can remove the filter definition in web.xml and all the above files.

Display Tag For Tables

AIDATLD For Plots

GLAST Commons

Filters

Logging

  • No labels