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.
Download end extract the following zip file containing a skeleton for your new web application.
The GLAST Commons is a collections of common code that can and should be shared across different GLAST web application providing a uniform look and feel. The following items are provided by the GLAST Commons and are used in the skeleton provided above:
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:
The above decorators share common code stored in the form of tag files:
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.
We use the Display tag library to create sortable tables. We provide a simple jsp example (src/webapp/table.jsp) that displays a sample list of items created using the java classes in src/main/java/org/glast/web/base/table.
To use the Display tag library all you have to do is to include the tag library definition at the top of your jsp page:
<%@taglib prefix="display" uri="http://displaytag.sf.net" %>
and use the prefix display to access the table tags.
Additionally, if you specify the table's class to be datatable, as done in the example below, you will get the default styles provided by the GLAST Commons and used by most of the other GLAST web applications.
<display:table class="datatable" name="${table}" defaultorder="ascending" sort="list" id="tableId" >