www.javadevhome.com

Google
   

Web Application aRchive - WAR

   
 
- Server-side utility classes (database beans, shopping carts, and so on).
- Static web resources (HTML, image, and sound files, and so on)
- Client-side classes (applets and utility classes)

A WAR has a specific hierarchical directory structure:
- The top-level directory of a WAR is the document root of the application.
- The document root is where JSP pages, client-side classes and archives, and static web resources are stored.

The document root contains a subdirectory called WEB-INF, which contains the following files and directories:
- web.xml - the web application deployment descriptor
- Tag library descriptor files (see Tag Library Descriptors).
- classes - a directory that contains server-side classes: servlet, utility classes, and JavaBeans components.
- lib - a directory that contains JAR archives of libraries (tag libraries and any utility libraries called by server-side classes).

webApplicationName.war
├ META-INF
│ └ MANIFEST.MF
├ WEB-INF
│ ├ classes : java class files
│ ├ lib : jar files
│ └ web.xml, taglib.tld, struts-config.xml, struts-bean.tld, tiles-def.xml
└ index.html, firstPage.jsp, error.jsp



web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>myWebApplication</display-name>

<context-param>
<param-name>applicationVersion</param-name>
<param-value>1.1.0</param-value>
</context-param>

<filter>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.util.FilterChainProxy</param-value>
</init-param>
</filter>
<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>com.javaHome.MyActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/struts-config.xml
</param-value>
</init-param>
<load-on-startup>18</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<session-config>
<session-timeout>120</session-timeout>
</session-config>


<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<error-page>
<error-code>404</error-code>
<location>error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>

<jsp-config>
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
</jsp-config>
</web-app>