This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/struts-archetypes.git
The following commit(s) were added to refs/heads/master by this push: new 602469d Fixes various small issues with archetypes 602469d is described below commit 602469de302558566717bea71e93e50bfcdbd2b6 Author: Lukasz Lenart <lukaszlen...@apache.org> AuthorDate: Fri May 1 10:12:36 2020 +0200 Fixes various small issues with archetypes --- .../src/main/resources/archetype-resources/pom.xml | 13 +++ .../archetype-resources/src/main/webapp/js/app.js | 2 - .../src/main/webapp/js/config.js | 2 - .../src/main/webapp/js/services/DataService.js | 2 - .../src/main/resources/archetype-resources/pom.xml | 13 +++ .../src/main/java/example/ExampleSupport.java | 2 - .../src/main/java/example/HelloWorld.java | 2 - .../src/main/java/example/Login.java | 2 - .../src/test/java/example/ConfigTest.java | 49 ++++---- .../src/test/java/example/HelloWorldTest.java | 15 +-- .../src/test/java/example/LoginTest.java | 28 +++-- .../src/main/resources/archetype-resources/pom.xml | 13 +++ .../src/test/java/actions/HelloActionTest.java | 9 +- .../src/test/java/actions/IndexTest.java | 7 +- .../META-INF/maven/archetype-metadata.xml | 24 ++-- .../src/main/resources/archetype-resources/pom.xml | 35 +++--- .../src/main/java/DateConverter.java | 3 - .../src/main/java/HelloWorldAction.java | 1 - .../src/main/java/IndexAction.java | 3 - .../src/main/resources/applicationContext.xml | 10 +- .../src/main/resources/log4j2.xml | 1 - .../main/resources/struts-conversion.properties | 3 + .../src/main/resources/struts.properties | 130 --------------------- .../src/main/resources/struts.xml | 3 +- .../src/main/resources/xwork-conversion.properties | 4 - .../src/main/webapp/WEB-INF/decorators/main.jsp | 13 --- 26 files changed, 128 insertions(+), 261 deletions(-) diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml b/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml index cc8cbda..b89b676 100644 --- a/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml +++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml @@ -10,6 +10,7 @@ <properties> <struts2.version>${supported.struts2.version}</struts2.version> + <log4j2.version>2.12.1</log4j2.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -28,6 +29,18 @@ </dependency> <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-junit-plugin</artifactId> <version>\${struts2.version}</version> diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js index 6d2da17..7bae4d8 100644 --- a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js +++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js index 9b93aab..2cfb91c 100644 --- a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js +++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js index 9a8daf1..eadbbff 100644 --- a/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js +++ b/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml b/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml index 756bf7c..c829301 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/pom.xml @@ -10,6 +10,7 @@ <properties> <struts2.version>${supported.struts2.version}</struts2.version> + <log4j2.version>2.12.1</log4j2.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -28,6 +29,18 @@ </dependency> <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-junit-plugin</artifactId> <version>\${struts2.version}</version> diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/ExampleSupport.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/ExampleSupport.java index a442b39..b721a23 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/ExampleSupport.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/ExampleSupport.java @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/HelloWorld.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/HelloWorld.java index 3f01cd4..5d6d553 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/HelloWorld.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/HelloWorld.java @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/Login.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/Login.java index 988d728..379567e 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/Login.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/main/java/example/Login.java @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java index 84ffc05..137ebb1 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/ConfigTest.java @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -26,37 +24,34 @@ import com.opensymphony.xwork2.config.RuntimeConfiguration; import com.opensymphony.xwork2.config.entities.ActionConfig; import com.opensymphony.xwork2.config.entities.ResultConfig; import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; +import org.apache.struts2.StrutsTestCase; -import java.util.Map; import java.util.List; +import java.util.Map; import org.apache.struts2.StrutsTestCase; public class ConfigTest extends StrutsTestCase { - protected void assertSuccess(String result) throws Exception { - assertTrue("Expected a success result!", - ActionSupport.SUCCESS.equals(result)); + protected void assertSuccess(String result) { + assertEquals("Expected a success result!", ActionSupport.SUCCESS, result); } - protected void assertInput(String result) throws Exception { - assertTrue("Expected an input result!", - ActionSupport.INPUT.equals(result)); + protected void assertInput(String result) { + assertEquals("Expected an input result!", ActionSupport.INPUT, result); } - protected Map assertFieldErrors(ActionSupport action) throws Exception { + protected Map<String, List<String>> assertFieldErrors(ActionSupport action) { assertTrue(action.hasFieldErrors()); return action.getFieldErrors(); } - protected void assertFieldError(Map field_errors, String field_name, String error_message) { - - List errors = (List) field_errors.get(field_name); - assertNotNull("Expected errors for " + field_name, errors); - assertTrue("Expected errors for " + field_name, errors.size()>0); + protected void assertFieldError(Map<String, List<String>> fieldErrors, String fieldName, String errorMessage) { + List<String> errors = fieldErrors.get(fieldName); + assertNotNull("Expected errors for " + fieldName, errors); + assertTrue("Expected errors for " + fieldName, errors.size() > 0); // TODO: Should be a loop - assertEquals(error_message,errors.get(0)); - + assertEquals(errorMessage, errors.get(0)); } protected void setUp() throws Exception { @@ -70,8 +65,7 @@ public class ConfigTest extends StrutsTestCase { RuntimeConfiguration configuration = configurationManager.getConfiguration().getRuntimeConfiguration(); ActionConfig config = configuration.getActionConfig(namespace, action_name); assertNotNull("Mssing action", config); - assertTrue("Wrong class name: [" + config.getClassName() + "]", - class_name.equals(config.getClassName())); + assertEquals("Wrong class name: [" + config.getClassName() + "]", class_name, config.getClassName()); return config; } @@ -79,18 +73,17 @@ public class ConfigTest extends StrutsTestCase { return assertClass("", action_name, class_name); } - protected void assertResult(ActionConfig config, String result_name, String result_value) { - Map results = config.getResults(); - ResultConfig result = (ResultConfig) results.get(result_name); - Map params = result.getParams(); - String value = (String) params.get("actionName"); + protected void assertResult(ActionConfig config, String resultName, String resultValue) { + Map<String, ResultConfig> results = config.getResults(); + ResultConfig result = results.get(resultName); + Map<String, String> params = result.getParams(); + String value = params.get("actionName"); if (value == null) - value = (String) params.get("location"); - assertTrue("Wrong result value: [" + value + "]", - result_value.equals(value)); + value = params.get("location"); + assertEquals("Wrong result value: [" + value + "]", resultValue, value); } - public void testConfig() throws Exception { + public void testConfig() { assertNotNull(configurationManager); } diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java index 27397a9..a5ca567 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/HelloWorldTest.java @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -28,12 +26,11 @@ import org.apache.struts2.StrutsTestCase; public class HelloWorldTest extends StrutsTestCase { public void testHelloWorld() throws Exception { - HelloWorld hello_world = container.inject(HelloWorld.class); - ActionContext.getContext().getContainer().inject(hello_world); - String result = hello_world.execute(); - assertTrue("Expected a success result!", - ActionSupport.SUCCESS.equals(result)); - assertTrue("Expected the default message!", - hello_world.getText(HelloWorld.MESSAGE).equals(hello_world.getMessage())); + HelloWorld helloWorld = container.inject(HelloWorld.class); + ActionContext.getContext().getContainer().inject(helloWorld); + String result = helloWorld.execute(); + assertEquals("Expected a success result!", ActionSupport.SUCCESS, result); + assertEquals("Expected the default message!", helloWorld.getText(HelloWorld.MESSAGE), helloWorld.getMessage()); } + } diff --git a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java index d12faad..88f9445 100644 --- a/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java +++ b/struts2-archetype-blank/src/main/resources/archetype-resources/src/test/java/example/LoginTest.java @@ -1,6 +1,4 @@ /* - * $Id$ - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -21,17 +19,19 @@ package ${package}.example; +import com.opensymphony.xwork2.ActionProxy; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.config.entities.ActionConfig; +import java.util.List; import java.util.Map; public class LoginTest extends ConfigTest { - public void FIXME_testLoginConfig() throws Exception { - ActionConfig config = assertClass("example", "Login_input", "example.Login"); + public void testLoginConfig() { + ActionConfig config = assertClass("/example", "Login_input", "${package}.Login"); assertResult(config, ActionSupport.SUCCESS, "Menu"); - assertResult(config, ActionSupport.INPUT, "/example/Login.jsp"); + assertResult(config, ActionSupport.INPUT, "/WEB-INF/example/Login.jsp"); } public void testLoginSubmit() throws Exception { @@ -42,14 +42,18 @@ public class LoginTest extends ConfigTest { assertSuccess(result); } - // Needs access to an envinronment that includes validators - public void FIXME_testLoginSubmitInput() throws Exception { - Login login = container.inject(Login.class); - String result = login.execute(); + public void testLoginSubmitInput() throws Exception { + // given + ActionProxy proxy = getActionProxy("/example/Login"); + + // when + String result = proxy.execute(); + + // then assertInput(result); - Map errors = assertFieldErrors(login); - assertFieldError(errors,"username","Username is required."); - assertFieldError(errors,"password","Password is required."); + Map<String, List<String>> errors = assertFieldErrors((ActionSupport) proxy.getAction()); + assertFieldError(errors, "username", "User Name is required."); + assertFieldError(errors, "password", "Password is required."); } } diff --git a/struts2-archetype-convention/src/main/resources/archetype-resources/pom.xml b/struts2-archetype-convention/src/main/resources/archetype-resources/pom.xml index 9c85b4d..42025a2 100644 --- a/struts2-archetype-convention/src/main/resources/archetype-resources/pom.xml +++ b/struts2-archetype-convention/src/main/resources/archetype-resources/pom.xml @@ -10,6 +10,7 @@ <properties> <struts2.version>${supported.struts2.version}</struts2.version> + <log4j2.version>2.12.1</log4j2.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> @@ -28,6 +29,18 @@ </dependency> <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-junit-plugin</artifactId> <version>\${struts2.version}</version> diff --git a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java index 8b83735..a789216 100644 --- a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java +++ b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java @@ -7,13 +7,12 @@ import com.opensymphony.xwork2.ActionSupport; public class HelloActionTest extends StrutsTestCase { - public void testHelloAction() throws Exception { + public void testHelloAction() { HelloAction hello = new HelloAction(); ActionContext.getContext().getContainer().inject(hello); String result = hello.execute(); - assertTrue("Expected a success result!", - ActionSupport.SUCCESS.equals(result)); - assertTrue("Expected the default message!", - hello.getText(HelloAction.MESSAGE).equals(hello.getMessage())); + assertEquals("Expected a success result!", ActionSupport.SUCCESS, result); + assertEquals("Expected the default message!", hello.getText(HelloAction.MESSAGE), hello.getMessage()); } + } diff --git a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java index 2c02a70..517062a 100644 --- a/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java +++ b/struts2-archetype-convention/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java @@ -5,10 +5,11 @@ import org.apache.struts2.StrutsTestCase; public class IndexTest extends StrutsTestCase { - public void testIndex() throws Exception { + public void testIndex() { Index index = new Index(); String result = index.execute(); - assertTrue("Expected a success result!", ActionSupport.SUCCESS.equals(result)); - assertTrue("Expected the 'hello' action name!!", "hello".equals(index.getRedirectName())); + assertEquals("Expected a success result!", ActionSupport.SUCCESS, result); + assertEquals("Expected the 'hello' action name!!", "hello", index.getRedirectName()); } + } diff --git a/struts2-archetype-starter/src/main/resources/META-INF/maven/archetype-metadata.xml b/struts2-archetype-starter/src/main/resources/META-INF/maven/archetype-metadata.xml index 565b0aa..bbd463a 100644 --- a/struts2-archetype-starter/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/struts2-archetype-starter/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<archetype-descriptor name="struts2-archetype-starter"> +<archetype-descriptor name="struts2-archetype-convention"> + <fileSets> <fileSet filtered="true" packaged="true"> <directory>src/main/java</directory> @@ -15,17 +16,11 @@ </includes> </fileSet> - <fileSet filtered="false" packaged="false"> - <directory>src/main/resources</directory> - <includes> - <include>**/*.properties</include> - </includes> - </fileSet> - <fileSet filtered="true" packaged="false"> <directory>src/main/resources</directory> <includes> - <include>**/struts.xml</include> + <include>**/*.xml</include> + <include>**/*.properties</include> </includes> </fileSet> @@ -33,21 +28,16 @@ <directory>src/main/webapp</directory> <includes> <include>**/*.jsp</include> + <include>**/*.css</include> </includes> </fileSet> - <fileSet filtered="false" packaged="false"> - <directory>src/main/webapp</directory> - <includes> - <include>**/index.html</include> - </includes> - </fileSet> - - <fileSet filtered="false" packaged="false"> + <fileSet filtered="true" packaged="false"> <directory>src/main/webapp/WEB-INF</directory> <includes> <include>**/*.xml</include> </includes> </fileSet> </fileSets> + </archetype-descriptor> diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/pom.xml b/struts2-archetype-starter/src/main/resources/archetype-resources/pom.xml index 6bb869b..6627fd0 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/pom.xml +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/pom.xml @@ -12,19 +12,11 @@ <properties> <struts2.version>${supported.struts2.version}</struts2.version> + <log4j2.version>2.12.1</log4j2.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> - <!-- Junit --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> - <scope>test</scope> - </dependency> - - <!-- Struts 2 --> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> @@ -49,7 +41,18 @@ <version>\${struts2.version}</version> </dependency> - <!-- Servlet & Jsp --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>${log4j2.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>${log4j2.version}</version> + </dependency> + <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> @@ -64,20 +67,26 @@ <scope>provided</scope> </dependency> - - <!-- Jakarta Commons --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.3</version> </dependency> - <!-- Dwr --> <dependency> <groupId>uk.ltd.getahead</groupId> <artifactId>dwr</artifactId> <version>1.1-beta-3</version> </dependency> + + <!-- Tests --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + </dependencies> <build> diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/DateConverter.java b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/DateConverter.java index 0998cca..a0c0902 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/DateConverter.java +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/DateConverter.java @@ -23,9 +23,6 @@ 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) { diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java index b50e7ef..6874e63 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/HelloWorldAction.java @@ -23,7 +23,6 @@ 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 { diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java index 91446de..c5197f5 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/java/IndexAction.java @@ -20,9 +20,6 @@ import java.util.Date; import com.opensymphony.xwork2.conversion.annotations.Conversion; import com.opensymphony.xwork2.conversion.annotations.TypeConversion; -/** - * - */ @Conversion() public class IndexAction extends ActionSupport { diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/applicationContext.xml b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/applicationContext.xml index 88c31b2..2449c40 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/applicationContext.xml +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/applicationContext.xml @@ -1,10 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE beans PUBLIC - "-//SPRING//DTD BEAN//EN" - "http://www.springframework.org/dtd/spring-beans.dtd"> - +<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "springframework.org/dtd/spring-beans-2.0.dtd"> + <beans> - <!-- Example of SAF2 action instantiated by Spring --> - <bean id="helloWorldAction" class="${package}.HelloWorldAction" singleton="false" /> + <!-- Example of Struts action instantiated by Spring --> + <bean id="helloWorldAction" class="com.demo.HelloWorldAction" scope="prototype"/> </beans> diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/log4j2.xml b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/log4j2.xml index d0cdc6d..6d27d12 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/log4j2.xml +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/log4j2.xml @@ -6,7 +6,6 @@ </Console> </Appenders> <Loggers> - <Logger name="com.opensymphony.sitemesh" level="info"/> <Logger name="com.opensymphony.xwork2" level="info"/> <Logger name="org.apache.struts2" level="info"/> <Logger name="\${groupId}" level="debug"/> diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts-conversion.properties b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts-conversion.properties new file mode 100644 index 0000000..6074ee7 --- /dev/null +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts-conversion.properties @@ -0,0 +1,3 @@ +# Global conversion goes here +# eg. +java.util.Date=${package}.DateConverter diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.properties b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.properties deleted file mode 100644 index 11328c9..0000000 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.properties +++ /dev/null @@ -1,130 +0,0 @@ -### START SNIPPET: complete_file - -### Struts 2.0 default properties -###(can be overridden by a struts.properties file in the root of the classpath) -### - -### 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 diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml index 8eef17a..3f6cc4f 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/struts.xml @@ -5,6 +5,7 @@ <struts> + <constant name="struts.devMode" value="true"/> <constant name="struts.enable.DynamicMethodInvocation" value="false"/> <package name="myPackage" extends="struts-default"> @@ -16,7 +17,7 @@ </action> <action name="helloWorld" class="helloWorldAction"> - <result name="input">/jsp/index.jsp</result> + <result name="input">/WEB-INF/jsp/index.jsp</result> <result>/WEB-INF/jsp/helloWorld.jsp</result> </action> diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/xwork-conversion.properties b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/xwork-conversion.properties deleted file mode 100644 index e4f632b..0000000 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/resources/xwork-conversion.properties +++ /dev/null @@ -1,4 +0,0 @@ -# SAF2 global conversion goes here -# eg. -# java.util.Date=com.myComp.myApp.DateConverter - diff --git a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp index 77aaaae..9b35935 100644 --- a/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp +++ b/struts2-archetype-starter/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/decorators/main.jsp @@ -11,19 +11,6 @@ <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">