Moving Struts 2 starter archetype

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@927413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Lukasz Lenart
2010-03-25 14:10:24 +00:00
parent 644e35f4d3
commit 2c920a2e8f
38 changed files with 1823 additions and 0 deletions
@@ -0,0 +1,53 @@
INFORMATION
===========
- This is Struts 2's "Starter" Maven Archetype
- To be used to create a simple webapp template that one could alter to meet his/her needs.
- The created template contains
- sitemesh integration
- a simple Struts action
- a simple Struts action level validation
- a simple Struts action alias level validation
- a simple Struts global conversion
- a simple Struts action level conversion
- a simple Struts global resource bundle
- a simple Struts action level resource bundle
USAGE
=====
- change directory to where the web app template is to be created,
for example, a 'projects' directory (which you may need to create):
cd /home/tmjee/projects
- run the following command to generate the sample web app template, assuming :-
- root java package -> com.myCompany.mySystem
- the webapp war name -> myWebApp
mvn archetype:create -DgroupId=com.myCompany.mySystem \
-DartifactId=myWebApp \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts2-archetype-starter \
-DarchetypeVersion=2.0.11
COMMON TASKS
==========
- to compile, execute
mvn compile
- to run test cases execute
mvn test
- to clean execute
mvn clean
- to package execute
mvn package
- to start it with jetty6 execute
mvn jetty:run
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>struts2-archetype-starter</artifactId>
<version>2.2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Struts 2 Archetypes - Starter</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/maven/trunk/struts2-archetype-starter/</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/maven/trunk/struts2-archetype-starter/</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/maven/trunk/struts2-archetype-starter/</url>
</scm>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype>
<id>struts2-archetype-starter</id>
<sources>
<source>src/main/java/HelloWorldAction.java</source>
<source>src/main/java/IndexAction.java</source>
<source>src/main/java/DateConverter.java</source>
</sources>
<resources>
<resource>src/main/resources/struts.xml</resource>
<resource>src/main/resources/xwork-conversion.properties</resource>
<resource>src/main/resources/struts.properties</resource>
<resource>src/main/resources/applicationContext.xml</resource>
<resource>src/main/resources/log4j.properties</resource>
<resource>src/main/webapp/jsp/index.jsp</resource>
<resource>src/main/webapp/jsp/helloWorld.jsp</resource>
<resource>src/main/webapp/WEB-INF/decorators/main.jsp</resource>
<resource>src/main/webapp/WEB-INF/decorators.xml</resource>
<resource>src/main/webapp/styles/main.css</resource>
<resource>src/main/webapp/styles/forms.css</resource>
<resource>src/main/webapp/styles/layout.css</resource>
<resource>src/main/webapp/styles/layout-1col.css</resource>
<resource>src/main/webapp/styles/layout-navleft-1col.css</resource>
<resource>src/main/webapp/styles/layout-navleft-2col.css</resource>
<resource>src/main/webapp/styles/layout-navtop-1col.css</resource>
<resource>src/main/webapp/styles/layout-navtop-3col.css</resource>
<resource>src/main/webapp/styles/layout-navtop-localleft.css</resource>
<resource>src/main/webapp/styles/layout-navtop-subright.css</resource>
<resource>src/main/webapp/styles/nav-horizontal.css</resource>
<resource>src/main/webapp/styles/nav-vertical.css</resource>
<resource>src/main/webapp/styles/tools.css</resource>
<resource>src/main/webapp/styles/typo.css</resource>
<resource>src/main/webapp/WEB-INF/dwr.xml</resource>
<resource>src/main/webapp/WEB-INF/sitemesh.xml</resource>
<resource>src/main/webapp/WEB-INF/web.xml</resource>
<resource>src/main/webapp/index.jsp</resource>
</resources>
<testSources>
<source>src/test/java/HelloWorldActionTest.java</source>
<source>src/test/java/IndexActionTest.java</source>
</testSources>
<testResources>
<resource>src/test/resources/test.properties</resource>
</testResources>
</archetype>
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<packaging>war</packaging>
<version>${version}</version>
<name>Struts 2 Starter</name>
<url>http://www.myComp.com</url>
<description>Struts 2 Starter</description>
<properties>
<struts2.version>2.1.8.1</struts2.version>
</properties>
<dependencies>
<!-- Junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Struts 2 -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<!-- Servlet & Jsp -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<!-- Jakarta Commons -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Dwr -->
<dependency>
<groupId>uk.ltd.getahead</groupId>
<artifactId>dwr</artifactId>
<version>1.1-beta-3</version>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,50 @@
/*
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package};
import org.apache.struts2.util.StrutsTypeConverter;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.Map;
import java.util.Date;
import com.opensymphony.xwork2.conversion.TypeConversionException;
/**
*
*/
public class DateConverter extends StrutsTypeConverter {
public Object convertFromString(Map context, String[] values, Class toClass) {
if (values != null && values.length > 0 && values[0] != null && values[0].length() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
try {
return sdf.parse(values[0]);
}
catch(ParseException e) {
throw new TypeConversionException(e);
}
}
return null;
}
public String convertToString(Map context, Object o) {
if (o instanceof Date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
return sdf.format((Date)o);
}
return "";
}
}
@@ -0,0 +1,45 @@
/*
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package};
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.validator.annotations.Validation;
import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.opensymphony.xwork2.conversion.annotations.Conversion;
import com.opensymphony.xwork2.conversion.annotations.TypeConversion;
@Validation()
@Conversion()
public class HelloWorldAction extends ActionSupport {
private Date now;
private String name;
@TypeConversion(converter = "${package}.DateConverter")
@RequiredFieldValidator(message = "Please enter the date")
public void setDateNow(Date now) { this.now = now; }
public Date getDateNow() { return now; }
@RequiredStringValidator(message = "Please enter a name", trim = true)
public void setName(String name) { this.name = name; }
public String getName() { return this.name; }
public String execute() throws Exception {
return SUCCESS;
}
}
@@ -0,0 +1,38 @@
/*
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package};
import com.opensymphony.xwork2.ActionSupport;
import java.util.Date;
import com.opensymphony.xwork2.conversion.annotations.Conversion;
import com.opensymphony.xwork2.conversion.annotations.TypeConversion;
/**
*
*/
@Conversion()
public class IndexAction extends ActionSupport {
private Date now = new Date(System.currentTimeMillis());
@TypeConversion(converter = "${package}.DateConverter")
public Date getDateNow() { return now; }
public String execute() throws Exception {
now = new Date(System.currentTimeMillis());
return SUCCESS;
}
}
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Example of SAF2 action instantiated by Spring -->
<bean id="helloWorldAction" class="${package}.HelloWorldAction" singleton="false" />
</beans>
@@ -0,0 +1,5 @@
#
# Here is where the global I18n messages goes
#
some.key=Some Messages
@@ -0,0 +1,20 @@
log4j.rootLogger = DEBUG, stdout
log4j.category.com.opensymphony.sitemesh=DEBUG
log4j.category.org.apache.struts2=INFO
log4j.category.org.apache=INFO
log4j.category.catalia=INFO
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Threshold = DEBUG
log4j.appender.stdout.Target = System.out
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{ISO8601} %-5p [%F:%L] : %m%n
@@ -0,0 +1,135 @@
### START SNIPPET: complete_file
### Struts 2.0 default properties
###(can be overridden by a struts.properties file in the root of the classpath)
###
### Specifies the Configuration used to configure Struts 2.0
### one could extend org.apache.struts2.config.Configuration
### to build one's customize way of getting the configurations parameters into Struts 2.0
# struts.configuration=org.apache.struts2.config.DefaultConfiguration
### This can be used to set your default locale and encoding scheme
# struts.locale=en_US
struts.i18n.encoding=UTF-8
### if specified, the default object factory can be overridden here
### Note: short-hand notation is supported in some cases, such as "spring"
### Alternatively, you can provide a com.opensymphony.xwork2.ObjectFactory subclass name here
struts.objectFactory = spring
### specifies the autoWiring logic when using the SpringObjectFactory.
### valid values are: name, type, auto, and constructor (name is the default)
struts.objectFactory.spring.autoWire = name
### indicates to the struts-action-2.0-spring integration if Class instances should be cached
### this should, until a future Spring release makes it possible, be left as true
### unless you know exactly what you are doing!
### valid values are: true, false (true is the default)
struts.objectFactory.spring.useClassCache = true
### if specified, the default object type determiner can be overridden here
### Note: short-hand notation is supported in some cases, such as "tiger" or "notiger"
### Alternatively, you can provide a com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation name here
### Note: if you have the xwork2-tiger.jar within your classpath, GenericsObjectTypeDeterminer is used by default
### To disable tiger support use the "notiger" property value here.
#struts.objectTypeDeterminer = tiger
#struts.objectTypeDeterminer = notiger
### Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data
# struts.multipart.parser=cos
# struts.multipart.parser=pell
struts.multipart.parser=jakarta
# uses javax.servlet.context.tempdir by default
struts.multipart.saveDir=
struts.multipart.maxSize=2097152
### Load custom property files (does not override struts.properties!)
# struts.custom.properties=application,com/webwork/extension/custom
### How request URLs are mapped to and from actions
struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
### Used by the DefaultActionMapper
### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
struts.action.extension=action
### Used by FilterDispatcher
### If true then SAF serves static content from inside its jar.
### If false then the static content must be available at <context_path>/struts
struts.serve.static=true
### Used by FilterDispatcher
### This is good for development where one wants changes to the static content be
### fetch on each request.
### NOTE: This will only have effect if struts.serve.static=true
### If true -> SAF will write out header for static contents such that they will
### be cached by web browsers (using Date, Cache-Content, Pragma, Expires)
### headers).
### If false -> SAF will write out header for static contents such that they are
### NOT to be cached by web browser (using Cache-Content, Pragma, Expires
### headers)
struts.serve.static.browserCache=true
### use alternative syntax that requires %{} in most places
### to evaluate expressions for String attributes for tags
struts.tag.altSyntax=true
### when set to true, Struts 2.0 will act much more friendly for developers. This
### includes:
### - struts.i18n.reload = true
### - struts.configuration.xml.reload = true
### - raising various debug or ignorable problems to errors
### For example: normally a request to foo.action?someUnknownField=true should
### be ignored (given that any value can come from the web and it
### should not be trusted). However, during development, it may be
### useful to know when these errors are happening and be told of
### them right away.
struts.devMode = false
### when set to true, resource bundles will be reloaded on _every_ request.
### this is good during development, but should never be used in production
struts.i18n.reload=false
### Standard UI theme
### Change this to reflect which path should be used for JSP control tag templates by default
struts.ui.theme=xhtml
struts.ui.templateDir=template
#sets the default template type. Either ftl, vm, or jsp
struts.ui.templateSuffix=ftl
### Configuration reloading
### This will cause the configuration to reload struts.xml when it is changed
struts.configuration.xml.reload=false
### Location of velocity.properties file. defaults to velocity.properties
# struts.velocity.configfile = velocity.properties
### Comma separated list of VelocityContext classnames to chain to the StrutsVelocityContext
# struts.velocity.contexts =
### used to build URLs, such as the UrlTag
struts.url.http.port = 80
struts.url.https.port = 443
### Load custom default resource bundles
# struts.custom.i18n.resources=testmessages,testmessages2
struts.custom.i18n.resources=globalmessages
### workaround for some app servers that don't handle HttpServletRequest.getParameterMap()
### often used for WebLogic, Orion, and OC4J
struts.dispatcher.parametersWorkaround = false
### configure the Freemarker Manager class to be used
### Allows user to plug-in customised Freemarker Manager if necessary
### MUST extends off org.apache.struts2.views.freemarker.FreemarkerManager
#struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager
### See the StrutsBeanWrapper javadocs for more information
struts.freemarker.wrapper.altMap=true
### configure the XSLTResult class to use stylesheet caching.
### Set to true for developers and false for production.
struts.xslt.nocache=false
### END SNIPPET: complete_file
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="myPackage" extends="struts-default">
<action name="index" class="${package}.IndexAction">
<result>/jsp/index.jsp</result>
</action>
<action name="helloWorld" class="helloWorldAction">
<result name="input">/jsp/index.jsp</result>
<result>/jsp/helloWorld.jsp</result>
</action>
</package>
</struts>
@@ -0,0 +1,4 @@
# SAF2 global conversion goes here
# eg.
# java.util.Date=com.myComp.myApp.DateConverter
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<decorators defaultdir="/WEB-INF/decorators">
<!-- Any urls that are excluded will never be decorated by Sitemesh -->
<excludes>
<pattern>/nodecorate/*</pattern>
<pattern>/styles/*</pattern>
<pattern>/scripts/*</pattern>
<pattern>/images/*</pattern>
<pattern>/dojo/*</pattern>
<pattern>/struts/*</pattern>
</excludes>
<decorator name="main" page="main.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
@@ -0,0 +1,86 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><decorator:title default="Struts Starter"/></title>
<link href="<s:url value='/styles/main.css'/>" rel="stylesheet" type="text/css" media="all"/>
<link href="<s:url value='/struts/niftycorners/niftyCorners.css'/>" rel="stylesheet" type="text/css"/>
<link href="<s:url value='/struts/niftycorners/niftyPrint.css'/>" rel="stylesheet" type="text/css" media="print"/>
<script language="JavaScript" type="text/javascript" src="<s:url value='/struts/niftycorners/nifty.js'/>"></script>
<script language="JavaScript" type="text/javascript">
window.onload = function(){
if(!NiftyCheck()) {
return;
}
// perform niftycorners rounding
// eg.
// Rounded("blockquote","tr bl","#ECF1F9","#CDFFAA","smooth border #88D84F");
}
</script>
<decorator:head/>
</head>
<body id="page-home">
<div id="page">
<div id="header" class="clearfix">
HEADER
<hr />
</div>
<div id="content" class="clearfix">
<div id="main">
<h3>Main Content</h3>
<decorator:body/>
<hr />
</div>
<div id="sub">
<h3>Sub Content</h3>
</div>
<div id="local">
<h3>Local Nav. Bar</h3>
<ul>
<li><a href="#">Content page 1</a></li>
<li><a href="#">Content page 2</a></li>
<li><a href="#">Content page 3</a></li>
<li><a href="#">Content page 4</a></li>
<li><a href="#">Content page 5</a></li>
<li><a href="#">Content page 6</a></li>
</ul>
</div>
<div id="nav">
<div class="wrapper">
<h3>Nav. bar</h3>
<ul class="clearfix">
<li><a href="#">Menu 1</a></li>
<li><a href="#">Menu 2</a></li>
<li><a href="#">Menu 3</a></li>
<li><a href="#">Menu 4</a></li>
<li><a href="#">Menu 5</a></li>
<li class="last"><a href="#">Menu 6</a></li>
</ul>
</div>
<hr />
</div>
</div>
<div id="footer" class="clearfix">
Footer
</div>
</div>
<div id="extra1">&nbsp;</div>
<div id="extra2">&nbsp;</div>
</body>
</html>
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
"http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
<allow>
<create creator="new" javascript="validator">
<param name="class" value="org.apache.struts2.validators.DWRValidator"/>
</create>
<convert converter="bean" match="com.opensymphony.xwork2.ValidationAwareSupport"/>
</allow>
<signatures>
<![CDATA[
import java.util.Map;
import org.apache.struts2.validators.DWRValidator;
DWRValidator.doPost(String, String, Map<String, String>);
]]>
</signatures>
</dwr>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<sitemesh>
<property name="decorators-file" value="/WEB-INF/decorators.xml"/>
<excludes file="${decorators-file}"/>
<page-parsers>
<parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.FastPageParser"/>
</page-parsers>
<decorator-mappers>
<mapper class="com.opensymphony.module.sitemesh.mapper.PageDecoratorMapper">
<param name="property.1" value="meta.decorator"/>
<param name="property.2" value="decorator"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.FrameSetDecoratorMapper">
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.AgentDecoratorMapper">
<param name="match.MSIE" value="ie"/>
<param name="match.Mozilla [" value="ns"/>
<param name="match.Opera" value="opera"/>
<param name="match.Lynx" value="lynx"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper">
<param name="decorator" value="printable"/>
<param name="parameter.name" value="printable"/>
<param name="parameter.value" value="true"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.RobotDecoratorMapper">
<param name="decorator" value="robot"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.ParameterDecoratorMapper">
<param name="decorator.parameter" value="decorator"/>
<param name="parameter.name" value="confirm"/>
<param name="parameter.value" value="true"/>
</mapper>
<mapper class="com.opensymphony.module.sitemesh.mapper.ConfigDecoratorMapper">
<param name="config" value="${decorators-file}"/>
</mapper>
</decorator-mappers>
</sitemesh>
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="starter" 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>Struts 2 - Maven Archetype - Starter</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
<!-- Filters -->
<filter>
<filter-name>action2-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter>
<filter-name>action2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>action2-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>action2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Listeners -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Servlets -->
<servlet>
<servlet-name>dwr</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>jspSupportServlet</servlet-name>
<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<!-- Welcome file lists -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
@@ -0,0 +1,2 @@
<% response.sendRedirect("index.action"); %>
@@ -0,0 +1,16 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Hello World</title>
<s:head />
</head>
<body>
Hello <s:property value="name"/>, today is <s:property value="dateNow" /><br/>
</body>
</html>
@@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Index</title>
<s:head />
</head>
<body>
<s:form action="helloWorld">
<s:textfield label="What is your name?" name="name" />
<s:textfield label="What is the date?" name="dateNow" />
<s:submit />
</s:form>
</body>
</html>
@@ -0,0 +1,100 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* FORM ELEMENTS */
form {
margin:0;
padding:0;
}
form div,
form p {
font-size: 1em;
margin: 0 0 1em 0;
padding: 0;
}
label {
font-weight: bold;
}
fieldset {
border: 1px solid #eee;
padding: 5px 10px;
margin: 0 0 1.5em 0;
}
fieldset legend {
color: #666;
font-size: 1.1em;
font-weight: bold;
margin: 0 0 0 0px;
padding: 0;
background-color: white;
}
* html fieldset legend {
margin: 0 0 10px -10px;
}
fieldset ul {
list-style: none;
margin: 0 0 1.5em 0;
padding: 0;
}
fieldset ul li {
list-style: none;
margin: 0 0 0.5em 0;
padding: 0;
}
input, select, textarea {
font-size:1em;
font-family: arial, helvetica, verdana, sans-serif;
margin: 0;
padding: 2px;
}
input, select {
vertical-align:middle;
}
textarea {
width: 200px;
height: 8em;
}
input.check {
border: none;
width: auto;
height: auto;
margin: 0;
}
input.radio {
border: none;
width: auto;
height: auto;
margin: 0;
}
input.file {
height: auto;
width: 250px;
}
input.readonly {
background-color: transparent;
border: none;
}
input.button {
width: 10em;
border:1px solid black;
background-color: #ddd;
}
input.image {
border: none;
width: auto;
height: auto;
}
form div.submit {
margin: 1em 0;
}
form div.submit input {
height: 2em;
width: 15em;
}
/* END FORM ELEMENTS */
@@ -0,0 +1,27 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
width: 100%;
}
div#local {
display: none;
}
div#sub {
display: none;
}
div#nav {
display: none;
}
/* END CONTENT */
@@ -0,0 +1,31 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-vertical.css");
/* NAV BAR ON THE LEFT AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 780px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: right;
width: 560px;
display: inline;
}
div#local {
display: none;
}
div#sub {
display: none;
}
div#nav {
float: left;
width: 200px;
display: inline;
}
/* END CONTENT */
@@ -0,0 +1,39 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-vertical.css");
/* NAV BAR ON THE LEFT AND TWO COLUMNS OF CONTENT */
div#content {
position: relative;
width: 780px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: right;
width: 340px;
display: inline;
margin-right: 220px;
margin-left: -220px;
}
div#local {
display: none;
}
div#sub {
float: right;
width: 200px;
display: inline;
margin-right: -340px;
margin-left: 200px;
}
div#nav {
float: left;
width: 200px;
display: inline;
}
/* END CONTENT */
@@ -0,0 +1,32 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
width: 100%;
}
div#local {
width: 100%;
}
div#sub {
width: 100%;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 100%;
text-align: left;
}
/* END CONTENT */
@@ -0,0 +1,43 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP, LOCAL NAV ON THE LEFT AND TWO COLUMNS OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: left;
width: 300px;
display: inline;
margin-right: -200px;
margin-left: 200px;
}
div#sub {
float: right;
width: 180px;
display: inline;
}
div#local {
float: left;
width: 180px;
display: inline;
margin-left: -300px;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 701px;
text-align: left;
}
/* END CONTENT */
@@ -0,0 +1,36 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP, LOCAL NAVIGATION ON THE LEFT AND ONE COLUMN OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: right;
width: 500px;
display: inline;
}
div#local {
float: left;
width: 200px;
display: inline;
}
div#sub {
display: none;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 100%;
text-align: left;
}
/* END CONTENT */
@@ -0,0 +1,36 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
@import url("nav-horizontal.css");
/* NAV BAR AT THE TOP AND TWO COLUMNS OF CONTENT */
div#content {
position: relative;
width: 701px;
margin: 0 auto 20px auto;
padding: 0;
text-align: left;
}
div#main {
float: left;
width: 480px;
display: inline;
}
div#sub {
float: right;
width: 200px;
display: inline;
}
div#local {
display: none;
}
div#nav {
position: absolute;
top: -15px;
left: 0;
width: 100%;
text-align: left;
}
/* END CONTENT */
@@ -0,0 +1,125 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* SITE SPECIFIC LAYOUT */
body {
margin: 0;
padding: 0;
background: white;
text-align: center;
}
div#page {
width: 780px;
margin: 0 auto;
padding: 0;
background: white;
text-align: center;
}
/* HEADER */
div#header {
margin: 0 0 5em 0;
padding: 40px 20px;
color: white;
background: black;
text-align: left;
}
div#branding {
float: left;
width: 40%;
margin: 0;
padding: 10px 0 10px 20px;
text-align: left;
}
div#search {
float: right;
width: 49%;
margin: 0;
padding: 16px 20px 0 0;
text-align: right;
}
/* END HEADER */
/* CONTENT */
div#content {
}
/* MAIN */
div#main {
}
/* END MAIN */
/* SUB */
div#sub {
}
/* END SUB */
/* END CONTENT */
/* FOOTER */
div#footer {
color: white;
background-color: black;
}
div#footer p {
font-size: 0.8em;
margin: 0;
padding: 15px;
}
/* END FOOTER */
/* END LAYOUT */
/* UL.SUBNAV */
ul.subnav {
margin: 0;
padding: 0;
font-size: 0.8em;
list-style: none;
}
ul.subnav li {
margin: 0 0 1em 0;
padding: 0;
list-style: none;
}
ul.subnav li a,
ul.subnav li a:link,
ul.subnav li a:visited,
ul.subnav li a:active {
text-decoration: none;
font-weight: bold;
color: black;
}
ul.subnav li a:hover {
text-decoration: underline;
}
ul.subnav li strong {
padding: 0 0 0 12px;
background: url("../i/subnav-highlight.gif") left top no-repeat transparent;
}
ul.subnav li strong a,
ul.subnav li strong a:link,
ul.subnav li strong a:visited,
ul.subnav li strong a:active {
color: white;
background-color: black;
}
/* END UL.SUBNAV */
@@ -0,0 +1,21 @@
/*
Css Framework
=============
- see http://www.contentwithstyle.co.uk/Articles/17/a-css-framework
for more info.
*/
@import url("tools.css");
@import url("typo.css");
@import url("forms.css");
/*
Swap layout stylesheet:
layout-navtop-localleft.css
layout-navtop-subright.css
layout-navtop-3col.css
layout-navtop-1col.css
layout-navleft-1col.css
layout-navleft-2col.css
*/
@import url("layout-navtop-localleft.css");
@import url("layout.css");
@@ -0,0 +1,80 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* NAV */
div#nav {
font-size: 0.8em;
}
* html div#nav {
/* hide ie/mac \*/
height: 1%;
/* end hide */
}
div#nav div.wrapper {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
}
div#nav ul {
width: auto;
width: 100%;
margin: 0;
padding: 0;
line-height: 1em;
list-style: none;
}
div#nav li {
float: left;
display: inline;
list-style: none;
margin: 0;
padding: 0;
line-height: 1em;
border-right: 1px solid #aaa;
}
div#nav li.last {
border-right: none;
}
div#nav a,
div#nav a:link,
div#nav a:active,
div#nav a:visited {
display: inline-block;
/* hide from ie/mac \*/
display: block;
/* end hide */
font-weight: bold;
text-decoration: none;
margin: 0;
padding: 5px 38px 5px 38px;
color: black;
background: #ddd;
}
div#nav a:hover {
text-decoration: underline;
}
div#nav strong {
display: inline-block;
/* hide from ie/mac \*/
display: block;
/* end hide */
color: white;
background: black;
}
div#nav strong a,
div#nav strong a:link,
div#nav strong a:active,
div#nav strong a:visited,
div#nav strong a:hover {
color: white;
background-color: black;
}
/* END NAV */
@@ -0,0 +1,79 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* NAV */
div#nav {
font-size: 0.8em;
}
* html div#nav {
/* hide ie/mac \*/
height: 1%;
/* end hide */
}
div#nav div.wrapper {
width: 100%;
background: #ddd;
}
div#nav ul {
width: auto;
width: 100%;
margin: 0;
padding: 0;
line-height: 1em;
list-style: none;
}
div#nav li {
display: block;
list-style: none;
margin: 0;
padding: 0;
line-height: 1em;
}
* html div#nav li {
/* hide ie/mac \*/
height: 1%;
/* end hide */
}
div#nav li.last {
}
div#nav a,
div#nav a:link,
div#nav a:active,
div#nav a:visited {
display: block;
font-weight: bold;
text-decoration: none;
margin: 0;
padding: 5px 10px 5px 10px;
color: black;
background: white;
}
div#nav a:hover {
color: white;
background: black;
text-decoration: underline;
}
div#nav strong {
display: block;
color: white;
background: black;
}
div#nav strong a,
div#nav strong a:link,
div#nav strong a:active,
div#nav strong a:visited,
div#nav strong a:hover {
color: white;
background-color: black;
}
/* END NAV */
@@ -0,0 +1,68 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* clearing */
.stretch,
.clear {
clear:both;
height:1px;
margin:0;
padding:0;
font-size: 15px;
line-height: 1px;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
* html>body .clearfix {
display: inline-block;
width: 100%;
}
* html .clearfix {
/* Hides from IE-mac \*/
height: 1%;
/* End hide from IE-mac */
}
/* end clearing */
/* replace */
.replace {
display:block;
background-repeat: no-repeat;
background-position: left top;
background-color:transparent;
}
/* tidy these up */
.replace * {
text-indent: -10000px;
display:block;
background-repeat: no-repeat;
background-position: left top;
background-color:transparent;
}
.replace a {
text-indent:0;
}
.replace a span {
text-indent:-10000px;
}
/* end replace */
/* accessibility */
span.accesskey {
text-decoration:none;
}
.accessibility {
position: absolute;
top: -999em;
left: -999em;
}
/* end accessibility */
@@ -0,0 +1,177 @@
/* A CSS Framework by Mike Stenhouse of Content with Style */
/* TYPOGRAPHY */
body {
text-align: left;
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 76%;
line-height: 1em;
color: #333;
}
div {
font-size: 1em;
}
img {
border: 0;
}
/* LINKS */
a,
a:link
a:active {
color: blue;
background-color: white;
text-decoration: underline;
}
a:visited {
color: purple;
background-color: transparent;
}
a:hover {
color: white;
background-color: black;
text-decoration: none;
}
/* END LINKS */
/* HEADINGS */
h1 {
font-size: 2em;
line-height: 1.5em;
margin: 0 0 0.5em 0;
padding: 0;
color: black;
}
h2 {
font-size: 1.5em;
line-height: 1.5em;
margin: 0 0 0.5em 0;
padding: 0;
color: black;
}
h3 {
font-size: 1.3em;
line-height: 1.3em;
margin: 0 0 0.5em 0;
padding:0;
color: black;
}
h4 {
font-size: 1.2em;
line-height: 1.3em;
margin: 0 0 0.25em 0;
padding: 0;
color: black;
}
h5 {
font-size: 1.1em;
line-height: 1.3em;
margin: 0 0 0.25em 0;
padding: 0;
color: black;
}
h6 {
font-size: 1em;
line-height: 1.3em;
margin: 0 0 0.25em 0;
padding: 0;
color: black;
}
/* END HEADINGS */
/* TEXT */
p {
font-size: 1em;
margin: 0 0 1.5em 0;
padding: 0;
line-height:1.4em;
}
blockquote {
border-left:10px solid #ddd;
margin-left:10px;
}
pre {
font-family: monospace;
font-size: 1.0em;
}
strong, b {
font-weight: bold;
}
em, i {
font-style:italic;
}
code {
font-family: "Courier New", Courier, monospace;
font-size: 1em;
white-space: pre;
}
/* END TEXT */
/* LISTS */
ul {
line-height:1.4em;
margin: 0 0 1.5em 0;
padding: 0;
}
ul li {
margin: 0 0 0.25em 30px;
padding: 0;
}
ol {
font-size: 1.0em;
line-height: 1.4em;
margin: 0 0 1.5em 0;
padding: 0;
}
ol li {
font-size: 1.0em;
margin: 0 0 0.25em 30px;
padding: 0;
}
dl {
margin: 0 0 1.5em 0;
padding: 0;
line-height: 1.4em;
}
dl dt {
font-weight: bold;
margin: 0.25em 0 0.25em 0;
padding: 0;
}
dl dd {
margin: 0 0 0 30px;
padding: 0;
}
/* END LISTS */
/* TABLE */
table {
font-size: 1em;
margin: 0 0 1.5em 0;
padding: 0;
}
table caption {
font-weight: bold;
margin: 0 0 0 0;
padding: 0 0 1.5em 0;
}
th {
font-weight: bold;
text-align: left;
}
td {
font-size: 1em;
}
/* END TABLE */
hr {
display: none;
}
div.hr {
height: 1px;
margin: 1.5em 10px;
border-bottom: 1px dotted black;
}
/* END TYPOGRAPHY */
@@ -0,0 +1,33 @@
/*
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package};
import junit.framework.TestCase;
import com.opensymphony.xwork2.Action;
/**
*
*/
public class HelloWorldActionTest extends TestCase {
public void testHelloWorldAction() throws Exception {
HelloWorldAction action = new HelloWorldAction();
String result = action.execute();
assertEquals(Action.SUCCESS, result);
}
}
@@ -0,0 +1,32 @@
/*
* Copyright 2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ${package};
import junit.framework.TestCase;
import com.opensymphony.xwork2.Action;
/**
*
*/
public class IndexActionTest extends TestCase {
public void testIndexAction() throws Exception {
IndexAction action = new IndexAction();
String result = action.execute();
assertEquals(Action.SUCCESS, result);
}
}
@@ -0,0 +1,4 @@
#
# Properties for test cases.
#