Author: roughley Date: Thu Feb 1 21:00:03 2007 New Revision: 502490 URL: http://svn.apache.org/viewvc?view=rev&rev=502490 Log: - removed property files (that need to be moved in order to be utilized) - added annotations for validation and conversions - changed the view from ftl to more common JSP
Added: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/helloWorld.jsp struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/index.jsp Removed: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/com/ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.ftl struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/ftl/ Modified: struts/maven/trunk/struts2-archetype-starter/README.txt struts/maven/trunk/struts2-archetype-starter/src/main/resources/META-INF/archetype.xml struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators.xml struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Modified: struts/maven/trunk/struts2-archetype-starter/README.txt URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/README.txt?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/README.txt (original) +++ struts/maven/trunk/struts2-archetype-starter/README.txt Thu Feb 1 21:00:03 2007 @@ -34,21 +34,6 @@ -DarchetypeVersion=2.0.2-SNAPSHOT \ -DremoteRepositories=http://people.apache.org/maven-snapshot-repository -IMPORTANT: -========== -- The generated template is a runnable webapp, some package renaming is necessary if -the Struts2 validation, conversion features is to work. In the case above, one would -need to rename the resources under - -src/main/resource/com/myComp/myApp/* - -to - -src/main/resource/com/myCompany/mySystem/* - -This is due to the fact that I can't find a way to change maven archetype resource -path dynamically. If anyone knows how kindly let us know (dev@struts.apache.org). -Tia COMMON TASKS ========== Modified: struts/maven/trunk/struts2-archetype-starter/src/main/resources/META-INF/archetype.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/META-INF/archetype.xml?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/META-INF/archetype.xml (original) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/META-INF/archetype.xml Thu Feb 1 21:00:03 2007 @@ -8,19 +8,14 @@ <source>src/main/java/DateConverter.java</source> </sources> <resources> - <resource>src/main/resources/com/myComp/myApp/HelloWorldAction-validation.xml</resource> - <resource>src/main/resources/com/myComp/myApp/HelloWorldAction-helloWorld-validation.xml</resource> - <resource>src/main/resources/com/myComp/myApp/IndexAction-conversion.properties</resource> - <resource>src/main/resources/com/myComp/myApp/IndexAction.properties</resource> - <resource>src/main/resources/com/myComp/myApp/package.properties</resource> <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/ftl/index.ftl</resource> - <resource>src/main/webapp/ftl/helloWorld.ftl</resource> - <resource>src/main/webapp/WEB-INF/decorators/main.ftl</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> Modified: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java (original) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java Thu Feb 1 21:00:03 2007 @@ -17,17 +17,29 @@ */ 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; -/** - * - */ [EMAIL PROTECTED]() [EMAIL PROTECTED]() public class HelloWorldAction extends ActionSupport { + private Date now; private String name; - public String getName() { return this.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; Modified: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java (original) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java Thu Feb 1 21:00:03 2007 @@ -18,7 +18,6 @@ package ${package}; import com.opensymphony.xwork2.ActionSupport; - import java.util.Date; /** @@ -26,10 +25,9 @@ */ public class IndexAction extends ActionSupport { - private Date now = new Date(System.currentTimeMillis());; + private Date now = new Date(System.currentTimeMillis()); public Date getDateNow() { return now; } - public void setDateNow(Date now) { this.now = now; } public String execute() throws Exception { now = new Date(System.currentTimeMillis()); Modified: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml (original) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml Thu Feb 1 21:00:03 2007 @@ -7,11 +7,11 @@ <struts> <package name="myPackage" extends="struts-default"> <action name="index" class="${package}.IndexAction"> - <result type="freemarker">/ftl/index.ftl</result> + <result>/jsp/index.jsp</result> </action> <action name="helloWorld" class="helloWorldAction"> - <result name="input" type="freemarker">/ftl/index.ftl</result> - <result type="freemarker">/ftl/helloWorld.ftl</result> + <result name="input">/jsp/index.jsp</result> + <result>/jsp/helloWorld.jsp</result> </action> </package> </struts> Modified: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators.xml?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators.xml (original) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators.xml Thu Feb 1 21:00:03 2007 @@ -11,10 +11,8 @@ <pattern>/struts/*</pattern> </excludes> - <decorator name="main" page="main.ftl"> + <decorator name="main" page="main.jsp"> <pattern>/*</pattern> </decorator> - <!--<decorator name="panel" page="panel.ftl"/>--> - <!--<decorator name="dashedBox" page="dashedBox.ftl"/>--> - <!--<decorator name="printable" page="printable.ftl"/>--> + </decorators> Added: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp?view=auto&rev=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp (added) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp Thu Feb 1 21:00:03 2007 @@ -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" %> +<[EMAIL PROTECTED] prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %> +<[EMAIL PROTECTED] prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %> +<[EMAIL PROTECTED] 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"> </div> + <div id="extra2"> </div> +</body> +</html> Modified: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml?view=diff&rev=502490&r1=502489&r2=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml (original) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Thu Feb 1 21:00:03 2007 @@ -19,14 +19,8 @@ </filter> <filter> <filter-name>sitemesh</filter-name> - <filter-class>org.apache.struts2.sitemesh.FreeMarkerPageFilter</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> Added: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/helloWorld.jsp URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/helloWorld.jsp?view=auto&rev=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/helloWorld.jsp (added) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/helloWorld.jsp Thu Feb 1 21:00:03 2007 @@ -0,0 +1,16 @@ +<!DOCTYPE html PUBLIC + "-//W3C//DTD XHTML 1.1 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<[EMAIL PROTECTED] 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> Added: struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/index.jsp URL: http://svn.apache.org/viewvc/struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/index.jsp?view=auto&rev=502490 ============================================================================== --- struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/index.jsp (added) +++ struts/maven/trunk/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/jsp/index.jsp Thu Feb 1 21:00:03 2007 @@ -0,0 +1,20 @@ +<!DOCTYPE html PUBLIC + "-//W3C//DTD XHTML 1.1 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<[EMAIL PROTECTED] 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> + \ No newline at end of file