mirror of
https://github.com/apache/struts.git
synced 2026-08-10 00:57:04 +00:00
Compare commits
239 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bf54d0b55 | |||
| d43e3a62a1 | |||
| abbe9ac9f0 | |||
| 81f7142724 | |||
| 86b9438c95 | |||
| 6aa62bed80 | |||
| 3607a431d8 | |||
| 25168e8db3 | |||
| 93153bee52 | |||
| c213d2fa6c | |||
| 23cb69662f | |||
| b9b7b14444 | |||
| 198a388fb4 | |||
| 8014b1bdce | |||
| d2f09a8c54 | |||
| fe040f475b | |||
| a80c3217bc | |||
| 3f39accc97 | |||
| 2bb92b0afc | |||
| c3d9bd313b | |||
| 71c6669067 | |||
| f43d64ab54 | |||
| 6d189742cd | |||
| 254df5ef9b | |||
| 6103113e9b | |||
| 8d6b944946 | |||
| a83155009c | |||
| f41ffc2421 | |||
| 33113a90c6 | |||
| 7b0ae6e96a | |||
| d4e3b19c9f | |||
| 7dafbb773f | |||
| 5ebf37efba | |||
| f8166d5e8b | |||
| 352fdb5300 | |||
| 9215250aad | |||
| 030c7e0193 | |||
| 7c795d7366 | |||
| bbdbe79929 | |||
| f4d486dbd3 | |||
| c502db56c1 | |||
| 38615eb398 | |||
| 6e1aa0784b | |||
| 9fa90cb8b4 | |||
| 2291033724 | |||
| 0da2e1bd1b | |||
| 7b94ab8e8d | |||
| 0d5093796d | |||
| 75c4c5ee25 | |||
| b90c0c8e60 | |||
| f207ed6978 | |||
| 268854f353 | |||
| 6c24b2e73c | |||
| d47688da3e | |||
| 08cd7213d4 | |||
| 7ebff0ee12 | |||
| ae2f937761 | |||
| 2e82cb684c | |||
| 6e131b75f3 | |||
| c8397a1188 | |||
| aebc654a59 | |||
| 4bc9f8f62d | |||
| 157eacdecd | |||
| 768f3973c2 | |||
| 10e69d7d93 | |||
| 718fa71af1 | |||
| fbaccd65ec | |||
| a3ee86862f | |||
| 9407fe5e30 | |||
| 5ecfccb0ed | |||
| f6bba24d44 | |||
| 4f46d2abb2 | |||
| 5397257cfb | |||
| ad49562c48 | |||
| dbedc4fae4 | |||
| 9fb18e8c0e | |||
| e135288df6 | |||
| 6199a40267 | |||
| 7ea81313d0 | |||
| f7a7d62a87 | |||
| 96683b99fc | |||
| bccea9737c | |||
| 7ba66cfd4c | |||
| 2cf1f83121 | |||
| f537d7b33b | |||
| 3ea1503324 | |||
| 502d7f3987 | |||
| 1f1c996eb1 | |||
| 3a08768f32 | |||
| b8c94a58b9 | |||
| b2c5190d52 | |||
| 04fcefa44b | |||
| e40a8e540b | |||
| dcf5d45fde | |||
| dea5b76acc | |||
| 73df90c49f | |||
| 9e5c40482e | |||
| 68d84d684d | |||
| 18724a34cb | |||
| 4db454df70 | |||
| b57ec7454a | |||
| 3d0cd93746 | |||
| 32683d3acd | |||
| 6070c4ff6d | |||
| abef0ef66f | |||
| 708019a721 | |||
| be385243cd | |||
| 92c1e7e8ff | |||
| b0666945bb | |||
| 568ea0598d | |||
| bead99cf95 | |||
| 0a0c3293ed | |||
| f2ff3a81d2 | |||
| 0b8fcdf609 | |||
| bc7ae89de3 | |||
| a5ae3c599b | |||
| a4ee229d43 | |||
| 60eddc6f17 | |||
| 78e853bcb3 | |||
| b43e67584c | |||
| 828b457ad6 | |||
| 0f08615c62 | |||
| 48dbfd8104 | |||
| f36ac2fcc0 | |||
| 122ab67bc1 | |||
| 108a676ee0 | |||
| 663365f156 | |||
| 2fd890506d | |||
| c5a87c85b8 | |||
| f7f3deedc8 | |||
| 295150b5e9 | |||
| 1fe337bb3d | |||
| 8d395ee27c | |||
| 8ced5d0f1f | |||
| b69f71aa2e | |||
| a4b404075c | |||
| 0d72932171 | |||
| 8f5e79d987 | |||
| 37371b3684 | |||
| cc68365a5f | |||
| 3fb3be2532 | |||
| e839817c48 | |||
| dad9f86de4 | |||
| 51ef883a72 | |||
| d733e103ba | |||
| 0a23cd4ec5 | |||
| 59d65a0aa7 | |||
| 2a7a22b206 | |||
| 561b08386a | |||
| 8378fbbd22 | |||
| 886cbda5cd | |||
| 9cbdb09169 | |||
| 6736da66a5 | |||
| d24822fb69 | |||
| 7dc0031e33 | |||
| 5476f03918 | |||
| 5d9bed1745 | |||
| 6a5c87319d | |||
| e654941b34 | |||
| e8a2fb1497 | |||
| 5a5f88205d | |||
| c760241930 | |||
| bc3301bb3e | |||
| 423360d377 | |||
| 3b6d7cfe82 | |||
| 873d150890 | |||
| 5030b89b33 | |||
| d0e828d5a5 | |||
| f0efd27bb7 | |||
| 71d6d3fade | |||
| 8e7df5a712 | |||
| 492ab02d97 | |||
| 54bf39cfcd | |||
| 4c1cbed577 | |||
| 16241f95a6 | |||
| f54ce89923 | |||
| 7140edf5e5 | |||
| 9efd7fcfd9 | |||
| 92cea867a3 | |||
| 2c54264bcc | |||
| 6f47a90767 | |||
| fa6a04576e | |||
| 43d1be3774 | |||
| 36d82cbc7f | |||
| 2c1ffa7e73 | |||
| 5a2759896f | |||
| cf1150f58c | |||
| 2019385915 | |||
| e07b7eb7d2 | |||
| dae35dfd9c | |||
| 9067fdc945 | |||
| 66b2491338 | |||
| ac1d6b48b8 | |||
| 9a22985c1f | |||
| 565b8f8642 | |||
| 61c03b374d | |||
| e05d71ba32 | |||
| bdc01ffb85 | |||
| 06030a440c | |||
| 09b43b1838 | |||
| 373988eb4a | |||
| 490a449979 | |||
| 1b9f55a2a6 | |||
| 1f2a359e0b | |||
| cac2ed6cad | |||
| 974e051bc5 | |||
| e9cb4945cf | |||
| 0a76d80364 | |||
| a8b3dcab97 | |||
| 9dc575f3b4 | |||
| 41e0cf7797 | |||
| 6e44ec6c00 | |||
| 61f943d751 | |||
| be1f09ca17 | |||
| dd4b4c007e | |||
| 9f6546dec0 | |||
| 5fc379f510 | |||
| 62e0acd2e5 | |||
| ed3b8e5a68 | |||
| 11df693e60 | |||
| 5f260d482a | |||
| 8ec3792752 | |||
| f3d09a04c1 | |||
| 6078c43b68 | |||
| 21f3bcbbed | |||
| e584c30992 | |||
| 12d3f3f842 | |||
| b02b2424f8 | |||
| f02befcd8f | |||
| 787370ffc0 | |||
| 3024f72a7e | |||
| 17c6b53a7f | |||
| 872012de45 | |||
| 0c162a4efb | |||
| 848b6f03ff | |||
| ff4c8ede24 | |||
| 80bcbd0b3e | |||
| 3f90a6cbe0 | |||
| 81dac44ab4 |
+5
-6
@@ -21,13 +21,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-blank</artifactId>
|
||||
@@ -35,9 +34,9 @@
|
||||
<name>Blank Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/blank/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/blank/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/blank/</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/blank</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/blank</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/apps/blank</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -10,6 +10,18 @@
|
||||
|
||||
<include file="example.xml"/>
|
||||
|
||||
|
||||
|
||||
<package name="default" namespace="/" extends="struts-default">
|
||||
<default-action-ref name="index" />
|
||||
<action name="index">
|
||||
<result type="redirectAction">
|
||||
<param name="actionName">HelloWorld</param>
|
||||
<param name="namespace">/example</param>
|
||||
</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<!-- Add packages here -->
|
||||
|
||||
</struts>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<filter>
|
||||
<filter-name>struts2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ConfigTest extends StrutsTestCase {
|
||||
ActionSupport.INPUT.equals(result));
|
||||
}
|
||||
|
||||
protected Map assertFieldErrors(ActionSupport action) throws Exception {
|
||||
protected Map<String, List<String>> assertFieldErrors(ActionSupport action) throws Exception {
|
||||
assertTrue(action.hasFieldErrors());
|
||||
return action.getFieldErrors();
|
||||
}
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-mailreader</artifactId>
|
||||
@@ -35,9 +34,9 @@
|
||||
<name>Starter Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/mailreader/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/mailreader/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/mailreader/</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/mailreader</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/mailreader</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/apps/mailreader</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<filter>
|
||||
<filter-name>Struts2</filter-name>
|
||||
<filter-class>
|
||||
org.apache.struts2.dispatcher.FilterDispatcher
|
||||
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
|
||||
</filter-class>
|
||||
</filter>
|
||||
|
||||
|
||||
+13
-39
@@ -21,14 +21,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
@@ -43,9 +41,9 @@
|
||||
</modules>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/apps</url>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -109,14 +107,10 @@
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<taskdef resource="hostedqatasks" classpathref="maven.plugin.classpath"/>
|
||||
<upload file="${project.build.directory}/${project.build.finalName}.war"
|
||||
account="struts" email="${email}"
|
||||
password="${password}" resourceId="${resourceId}"/>
|
||||
<taskdef resource="hostedqatasks" classpathref="maven.plugin.classpath" />
|
||||
<upload file="${project.build.directory}/${project.build.finalName}.war" account="struts" email="${email}" password="${password}" resourceId="${resourceId}" />
|
||||
|
||||
<playsuite suiteId="${suiteId}" clientConfigs="${clientConfigs}" appConfigs="${appConfigs}" account="struts"
|
||||
email="${email}"
|
||||
password="${password}"/>
|
||||
<playsuite suiteId="${suiteId}" clientConfigs="${clientConfigs}" appConfigs="${appConfigs}" account="struts" email="${email}" password="${password}" />
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
@@ -141,11 +135,10 @@
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<!--
|
||||
<plugin>
|
||||
<inherited>true</inherited>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>rat-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
@@ -169,7 +162,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
@@ -177,22 +169,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.cargo</groupId>
|
||||
<artifactId>cargo-maven2-plugin</artifactId>
|
||||
<version>0.3.1</version>
|
||||
<configuration>
|
||||
<container>
|
||||
<containerId>tomcat5x</containerId>
|
||||
<home>${cargo.tomcat5x.home}</home>
|
||||
<log>${project.build.directory}/tomcat5x.log</log>
|
||||
<output>${project.build.directory}/tomcat5x.out</output>
|
||||
</container>
|
||||
<configuration>
|
||||
<home>${project.build.directory}/tomcat5x</home>
|
||||
</configuration>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Include source code under WEB-INF/src/java -->
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
@@ -202,13 +178,11 @@
|
||||
<phase>process-sources</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java"
|
||||
failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/java"/>
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java" failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/java" />
|
||||
</copy>
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java"
|
||||
failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/resources"/>
|
||||
<copy todir="${project.build.directory}/${pom.artifactId}/WEB-INF/src/java" failonerror="false">
|
||||
<fileset dir="${basedir}/src/main/resources" />
|
||||
</copy>
|
||||
</tasks>
|
||||
</configuration>
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-portlet</artifactId>
|
||||
@@ -35,9 +34,9 @@
|
||||
<name>Portlet Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/portlet/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/portlet/</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/portlet</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/portlet</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/apps/portlet</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -1,26 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project>
|
||||
<!--
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.
|
||||
*/
|
||||
-->
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-showcase</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
<name>Struts 2 Rest Showcase Example</name>
|
||||
<description>Struts 2 Rest Showcase Example</description>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -28,9 +54,36 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-core</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-htmlunit-plugin</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>struts2-rest-showcase</finalName>
|
||||
<plugins>
|
||||
@@ -49,6 +102,43 @@
|
||||
<scanIntervalSeconds>10</scanIntervalSeconds>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.twdata.maven</groupId>
|
||||
<artifactId>maven-itblast-plugin</artifactId>
|
||||
<version>0.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<containers>tomcat5x</containers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>it/**</exclude>
|
||||
<exclude>**/*$*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!--
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>twdata-m2-repository</id>
|
||||
<name>twdata.org Maven Repository</name>
|
||||
<url>http://twdata-m2-repository.googlecode.com/svn/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
-->
|
||||
</project>
|
||||
|
||||
+7
-3
@@ -2,18 +2,22 @@ package org.apache.struts2.rest.example;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.struts2.config.Result;
|
||||
import org.apache.struts2.config.Results;
|
||||
import org.apache.struts2.dispatcher.ServletActionRedirectResult;
|
||||
import org.apache.struts2.rest.DefaultHttpHeaders;
|
||||
import org.apache.struts2.rest.HttpHeaders;
|
||||
import org.apache.struts2.convention.annotation.Results;
|
||||
import org.apache.struts2.convention.annotation.Result;
|
||||
import org.apache.struts2.convention.annotation.ParentPackage;
|
||||
import org.apache.struts2.convention.annotation.Namespaces;
|
||||
import org.apache.struts2.convention.annotation.Namespace;
|
||||
import org.apache.struts2.convention.annotation.InterceptorRef;
|
||||
|
||||
import com.opensymphony.xwork2.ModelDriven;
|
||||
import com.opensymphony.xwork2.Validateable;
|
||||
import com.opensymphony.xwork2.ValidationAwareSupport;
|
||||
|
||||
@Results({
|
||||
@Result(name="success", type=ServletActionRedirectResult.class, value="orders")
|
||||
@Result(name="success", type="redirectAction", params = {"actionName" , "orders"})
|
||||
})
|
||||
public class OrdersController extends ValidationAwareSupport implements ModelDriven<Object>, Validateable{
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
/*
|
||||
* $Id: struts-plugin.xml 722219 2008-12-01 20:41:26Z musachy $
|
||||
*
|
||||
* 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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
<struts>
|
||||
<!-- Overwrite Convention -->
|
||||
<constant name="struts.convention.action.suffix" value="Controller"/>
|
||||
<constant name="struts.convention.action.mapAllMatches" value="true"/>
|
||||
<constant name="struts.convention.default.parent.package" value="rest-default"/>
|
||||
|
||||
<constant name="struts.convention.package.locators" value="example"/>
|
||||
</struts>
|
||||
@@ -12,11 +12,7 @@
|
||||
<!-- START SNIPPET: filter -->
|
||||
<filter>
|
||||
<filter-name>action2</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
|
||||
<init-param>
|
||||
<param-name>actionPackages</param-name>
|
||||
<param-value>org.apache.struts2.rest.example</param-value>
|
||||
</init-param>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
|
||||
</filter>
|
||||
<!-- END SNIPPET: filter -->
|
||||
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package it.org.apache.struts2.rest.example;
|
||||
|
||||
import net.sourceforge.jwebunit.junit.WebTestCase;
|
||||
|
||||
public class GetOrdersTest extends WebTestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
|
||||
}
|
||||
|
||||
|
||||
public void testGetOrders() {
|
||||
beginAt("/orders/3");
|
||||
assertTextPresent("Bob");
|
||||
assertTextNotPresent("Sarah");
|
||||
}
|
||||
|
||||
public void testGetOrdersInHtml() {
|
||||
beginAt("/orders/3.xhtml");
|
||||
assertTextPresent("Bob");
|
||||
}
|
||||
|
||||
public void testGetOrdersInXml() {
|
||||
beginAt("/orders/3.xml");
|
||||
assertTextPresent("<clientName>Bob");
|
||||
}
|
||||
|
||||
public void testGetOrdersInJson() {
|
||||
beginAt("/orders/3.json");
|
||||
assertTextPresent("\"clientName\":\"Bob\"");
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package it.org.apache.struts2.rest.example;
|
||||
|
||||
import net.sourceforge.jwebunit.junit.WebTestCase;
|
||||
|
||||
public class ListOrdersTest extends WebTestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
|
||||
}
|
||||
|
||||
|
||||
public void testListOrders() {
|
||||
beginAt("/orders");
|
||||
assertTextPresent("Bob");
|
||||
assertTextPresent("Sarah");
|
||||
assertTextPresent("Jim");
|
||||
}
|
||||
|
||||
public void testListOrdersInHtml() {
|
||||
beginAt("/orders.xhtml");
|
||||
assertTextPresent("Bob");
|
||||
assertTextPresent("Sarah");
|
||||
assertTextPresent("Jim");
|
||||
}
|
||||
|
||||
public void testListOrdersInXml() {
|
||||
beginAt("/orders.xml");
|
||||
assertTextPresent("<clientName>Bob");
|
||||
assertTextPresent("<clientName>Sarah");
|
||||
assertTextPresent("<clientName>Jim");
|
||||
}
|
||||
|
||||
public void testListOrdersInJson() {
|
||||
beginAt("/orders.json");
|
||||
assertTextPresent("\"clientName\":\"Bob\"");
|
||||
assertTextPresent("\"clientName\":\"Sarah\"");
|
||||
assertTextPresent("\"clientName\":\"Jim\"");
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package it.org.apache.struts2.rest.example;
|
||||
|
||||
public class ParameterUtils {
|
||||
|
||||
public static String getBaseUrl() {
|
||||
String port = System.getProperty("http.port");
|
||||
if (port == null) {
|
||||
port = "8080";
|
||||
}
|
||||
return "http://localhost:"+port+"/struts2-rest-showcase";
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package it.org.apache.struts2.rest.example;
|
||||
|
||||
import net.sourceforge.jwebunit.junit.WebTestCase;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
|
||||
|
||||
public class PostOrderTest extends WebTestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
|
||||
}
|
||||
|
||||
|
||||
public void testPostOrder() {
|
||||
beginAt("/orders/new");
|
||||
setWorkingForm(0);
|
||||
setTextField("clientName", "Test1");
|
||||
setTextField("amount", "321");
|
||||
submit();
|
||||
assertTextPresent("Test1");
|
||||
assertLinkNotPresentWithText("Back to Orders");
|
||||
}
|
||||
|
||||
public void testPostOrderWithErrors() {
|
||||
beginAt("/orders/new");
|
||||
setWorkingForm(0);
|
||||
setTextField("amount", "321");
|
||||
try {
|
||||
submit();
|
||||
} catch (FailingHttpStatusCodeException ex) {
|
||||
// ignore;
|
||||
}
|
||||
assertTextPresent("client name is empty");
|
||||
assertTextFieldEquals("amount", "321");
|
||||
}
|
||||
|
||||
public void testPostOrderInHtml() {
|
||||
beginAt("/orders/new.xhtml");
|
||||
setWorkingForm(0);
|
||||
setTextField("clientName", "Test2");
|
||||
setTextField("amount", "321");
|
||||
try {
|
||||
submit();
|
||||
} catch (FailingHttpStatusCodeException ex) {
|
||||
// ignore;
|
||||
}
|
||||
assertTextPresent("Test2");
|
||||
assertLinkNotPresentWithText("Back to Orders");
|
||||
}
|
||||
|
||||
public void testPostOrderInXml() throws IOException {
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.xml");
|
||||
method.setRequestEntity(new StringRequestEntity("<org.apache.struts2.rest.example.Order>\n" +
|
||||
"<clientName>Test3</clientName>\n" +
|
||||
"<amount>3342</amount>\n" +
|
||||
"</org.apache.struts2.rest.example.Order>"));
|
||||
client.executeMethod(method);
|
||||
assertEquals(201, method.getStatusCode());
|
||||
assertTrue(method.getResponseHeader("Location").getValue().startsWith(ParameterUtils.getBaseUrl()+"/orders/"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void testPostOrderInXmlWithBadData() throws IOException {
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.xml");
|
||||
method.setRequestEntity(new StringRequestEntity("<org.apache.struts2.rest.example.Order>\n" +
|
||||
"<amount>3342</amount>\n" +
|
||||
"</org.apache.struts2.rest.example.Order>"));
|
||||
client.executeMethod(method);
|
||||
assertEquals(400, method.getStatusCode());
|
||||
String response = method.getResponseBodyAsString();
|
||||
assertTrue(response.contains("<string>The client name is empty"));
|
||||
assertNull(method.getResponseHeader("Location"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void testPostOrderInJson() throws IOException {
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.json");
|
||||
method.setRequestEntity(new StringRequestEntity("{\"amount\":33,\"clientName\":\"Test4\"}"));
|
||||
client.executeMethod(method);
|
||||
assertEquals(201, method.getStatusCode());
|
||||
assertTrue(method.getResponseHeader("Location").getValue().startsWith(ParameterUtils.getBaseUrl()+"/orders/"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public void testPostOrderInJsonWithBadData() throws IOException {
|
||||
HttpClient client = new HttpClient();
|
||||
PostMethod method = null;
|
||||
try {
|
||||
method = new PostMethod(ParameterUtils.getBaseUrl()+"/orders.json");
|
||||
method.setRequestEntity(new StringRequestEntity("{\"amount\":33}"));
|
||||
client.executeMethod(method);
|
||||
String response = method.getResponseBodyAsString();
|
||||
assertEquals(400, method.getStatusCode());
|
||||
|
||||
assertEquals("{\"actionErrors\":[],\"fieldErrors\":{\"clientName\":[\"The client name is empty\"]}}", response);
|
||||
assertNull(method.getResponseHeader("Location"));
|
||||
} finally {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
+80
-18
@@ -21,13 +21,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-apps</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-showcase</artifactId>
|
||||
@@ -35,9 +34,9 @@
|
||||
<name>Showcase Webapp</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/apps/showcase/</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/showcase</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/apps/showcase</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/apps/showcase</url>
|
||||
</scm>
|
||||
|
||||
|
||||
@@ -182,6 +181,32 @@
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-core</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jwebunit</groupId>
|
||||
<artifactId>jwebunit-htmlunit-plugin</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xom</groupId>
|
||||
<artifactId>xom</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -212,19 +237,56 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.twdata.maven</groupId>
|
||||
<artifactId>maven-itblast-plugin</artifactId>
|
||||
<version>0.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>execute</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<containers>tomcat5x</containers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
-->
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>it/**</exclude>
|
||||
<exclude>**/*$*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<!-- Include resources under src/main/java in WEB-INF/classes -->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.java</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<resources>
|
||||
<!-- Include resources under src/main/java in WEB-INF/classes -->
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.java</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
<!--
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>twdata-m2-repository</id>
|
||||
<name>twdata.org Maven Repository</name>
|
||||
<url>http://twdata-m2-repository.googlecode.com/svn/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
-->
|
||||
</project>
|
||||
|
||||
+2
-2
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
// START SNIPPET: entire-file
|
||||
package org.apache.struts2.showcase.fileupload;
|
||||
|
||||
import java.io.File;
|
||||
@@ -44,7 +45,6 @@ public class MultipleFileUploadUsingArrayAction extends ActionSupport {
|
||||
public String[] getUploadContentType() { return this.uploadContentTypes; }
|
||||
public void setUploadContentType(String[] uploadContentType) { this.uploadContentTypes = uploadContentType; }
|
||||
|
||||
|
||||
public String upload() throws Exception {
|
||||
System.out.println("\n\n upload2");
|
||||
System.out.println("files:");
|
||||
@@ -62,5 +62,5 @@ public class MultipleFileUploadUsingArrayAction extends ActionSupport {
|
||||
System.out.println("\n\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
// END SNIPPET: entire-file
|
||||
+2
-5
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
// START SNIPPET: entire-file
|
||||
package org.apache.struts2.showcase.fileupload;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -57,9 +58,6 @@ public class MultipleFileUploadUsingListAction extends ActionSupport {
|
||||
this.uploadContentTypes = contentTypes;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String upload() throws Exception {
|
||||
|
||||
System.out.println("\n\n upload1");
|
||||
@@ -78,6 +76,5 @@ public class MultipleFileUploadUsingListAction extends ActionSupport {
|
||||
System.out.println("\n\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// END SNIPPET: entire-file
|
||||
@@ -3,7 +3,7 @@
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.0.dtd">
|
||||
|
||||
|
||||
<struts>
|
||||
<package name="ui-tags" extends="struts-default" namespace="/tags/ui">
|
||||
<action name="example" class="org.apache.struts2.showcase.UITagExample">
|
||||
@@ -40,26 +40,30 @@
|
||||
</action>
|
||||
|
||||
<!-- START SNIPPET: treeExampleDynamicXWorkXml -->
|
||||
|
||||
|
||||
<action name="showDynamicTreeAction" class="org.apache.struts2.showcase.ShowDynamicTreeAction">
|
||||
<result>/tags/ui/treeExampleDynamic.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<!-- END SNIPPET: treeExampleDynamicXWorkXml -->
|
||||
|
||||
|
||||
<action name="showDynamicAjaxTreeAction">
|
||||
<result>/tags/ui/treeExampleAjaxDynamic.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="showComponentTagExampleCode">
|
||||
<result type="plainText">/tags/ui/componentTagExample.jsp</result>
|
||||
</action>
|
||||
|
||||
|
||||
<action name="actionTagExample">
|
||||
<result>/tags/ui/actionTagExampleCalled.jsp</result>
|
||||
<result name="input">/tags/ui/actionTagExampleCalling.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
<!-- START SNIPPET: treeExampleXWorkXml -->
|
||||
|
||||
<package name="ui-tags-ajax" namespace="/tags/ui/ajax" extends="struts-default">
|
||||
|
||||
<package name="ui-tags-ajax" namespace="/tags/ui/ajax" extends="struts-default">
|
||||
<!-- Actions dealing with Tree Example -->
|
||||
<action name="staticTreeSelectAction">
|
||||
<result>/tags/ui/staticTreeSelect.jsp</result>
|
||||
@@ -68,6 +72,6 @@
|
||||
<result>/tags/ui/dynamicTreeSelect.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
|
||||
<!-- END SNIPPET: treeExampleXWorkXml -->
|
||||
</struts>
|
||||
|
||||
@@ -49,43 +49,43 @@
|
||||
</div><!-- end search -->
|
||||
|
||||
<hr/>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
</div><!-- end header -->
|
||||
|
||||
<div id="content" class="clearfix">
|
||||
|
||||
<decorator:body/>
|
||||
|
||||
<div id="nav">
|
||||
<div class="wrapper">
|
||||
<h2 class="accessibility">Navigation</h2>
|
||||
<ul class="clearfix">
|
||||
<li><a href="<s:url value="/showcase.jsp"/>">Home</a></li>
|
||||
<li><a href="<s:url value="/ajax/index.jsp"/>">Ajax</a></li>
|
||||
<li><a href="<s:url value="/chat/index.jsp"/>">Ajax Chat</a></li>
|
||||
<li><a href="<s:url action="actionChain1!input" namespace="/actionchaining" includeParams="none" />">Action Chaining</a></li>
|
||||
<li><a href="<s:url action="index" namespace="/config-browser" includeParams="none" />">Config Browser</a></li>
|
||||
<li><a href="<s:url value="/conversion/index.jsp"/>">Conversion</a></li>
|
||||
<li><a href="<s:url value="/empmanager/index.jsp"/>">CRUD</a></li>
|
||||
<li><a href="<s:url value="/wait/index.jsp"/>">Execute & Wait</a></li>
|
||||
<li><a href="<s:url value="/filedownload/index.jsp"/>">File Download</a></li>
|
||||
<li><a href="<s:url value="/fileupload" />">File Upload</a></li>
|
||||
<li><a href="<s:url value="/freemarker/index.jsp"/>">Freemarker</a>
|
||||
<li><a href="<s:url action="hangmanMenu" namespace="/hangman"/>">Hangman</a></li>
|
||||
<li><a href="<s:url value="/jsf/index.jsp"/>">JavaServer Faces</a></li>
|
||||
<li><a href="<s:url value="/person/index.jsp"/>">Person Manager</a></li>
|
||||
<li><a href="<s:url value="/tags/index.jsp"/>">Tags</a></li>
|
||||
<li><a href="<s:url value="/tiles/index.action" />">Tiles</a></li>
|
||||
<li><a href="<s:url value="/token/index.jsp"/>">Token</a></li>
|
||||
<li><a href="<s:url value="/validation/index.jsp"/>">Validation</a></li>
|
||||
<li><a href="<s:url value="/interactive/index.jsp"/>">Interactive Demo</a></li>
|
||||
<li class="last"><a href="<s:url value="/help.jsp"/>">Help</a></li>
|
||||
<li><a href="<s:url value="/showcase.jsp"/>">Home</a></li>
|
||||
<li><a href="<s:url value="/ajax/index.jsp"/>">Ajax</a></li>
|
||||
<li><a href="<s:url value="/chat/index.jsp"/>">Ajax Chat</a></li>
|
||||
<li><a href="<s:url action="actionChain1!input" namespace="/actionchaining" includeParams="none" />">Action Chaining</a></li>
|
||||
<li><a href="<s:url action="index" namespace="/config-browser" includeParams="none" />">Config Browser</a></li>
|
||||
<li><a href="<s:url value="/conversion/index.jsp"/>">Conversion</a></li>
|
||||
<li><a href="<s:url value="/empmanager/index.jsp"/>">CRUD</a></li>
|
||||
<li><a href="<s:url value="/wait/index.jsp"/>">Execute & Wait</a></li>
|
||||
<li><a href="<s:url value="/filedownload/index.jsp"/>">File Download</a></li>
|
||||
<li><a href="<s:url value="/fileupload/index.jsp" />">File Upload</a></li>
|
||||
<li><a href="<s:url value="/freemarker/index.jsp"/>">Freemarker</a>
|
||||
<li><a href="<s:url action="hangmanMenu" namespace="/hangman"/>">Hangman</a></li>
|
||||
<li><a href="<s:url value="/jsf/index.jsp"/>">JavaServer Faces</a></li>
|
||||
<li><a href="<s:url value="/tags/index.jsp"/>">Tags</a></li>
|
||||
<li><a href="<s:url value="/tiles/index.action" />">Tiles</a></li>
|
||||
<li><a href="<s:url value="/token/index.jsp"/>">Token</a></li>
|
||||
<li><a href="<s:url value="/validation/index.jsp"/>">Validation</a></li>
|
||||
<li><a href="<s:url value="/interactive/index.jsp"/>">Interactive Demo</a></li>
|
||||
<li><a href="<s:url value="/person/index.jsp"/>">Person Manager</a></li>
|
||||
<li class="last"><a href="<s:url value="/help.jsp"/>">Help</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
</div><!-- end nav -->
|
||||
|
||||
<decorator:body/>
|
||||
|
||||
</div><!-- end content -->
|
||||
|
||||
<div>
|
||||
@@ -95,6 +95,7 @@
|
||||
</div>
|
||||
<div id="footer" class="clearfix">
|
||||
<p>Copyright © 2003-<s:property value="#dateAction.now.year + 1900" /> The Apache Software Foundation.</p>
|
||||
<s:hidden name="project-name" value="Struts 2" />
|
||||
</div><!-- end footer -->
|
||||
<p/>
|
||||
|
||||
|
||||
@@ -7,26 +7,26 @@
|
||||
<display-name>Struts Showcase Application</display-name>
|
||||
|
||||
<filter>
|
||||
<filter-name>struts-cleanup</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>struts</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
|
||||
<filter-name>struts-prepare</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>actionPackages</param-name>
|
||||
<param-value>org.apache.struts2.showcase.person</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>struts-execute</filter-name>
|
||||
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter>
|
||||
<filter-name>sitemesh</filter-name>
|
||||
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>struts-cleanup</filter-name>
|
||||
<filter-name>struts-prepare</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</filter-mapping>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>struts</filter-name>
|
||||
<filter-name>struts-execute</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<li>$ { customFreemarkerManagerUtil.timeNow } - to get the time now</li>
|
||||
</ul>
|
||||
|
||||
Today's Date = ${customFreemarkerManagerUtil.todayDate}<br/>
|
||||
Time now = ${customFreemarkerManagerUtil.getTimeNow()}<br/>
|
||||
Today's Date = <span id="todaysDate">${customFreemarkerManagerUtil.todayDate}</span><br/>
|
||||
Time now = <span id="timeNow">${customFreemarkerManagerUtil.getTimeNow()}</span><br/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
position: relative;
|
||||
width: 98%;
|
||||
|
||||
margin: 5em auto 20px auto;
|
||||
margin: 5px auto 20px auto;
|
||||
padding: 0;
|
||||
|
||||
text-align: left;
|
||||
@@ -26,8 +26,6 @@
|
||||
display: none;
|
||||
}
|
||||
div#nav {
|
||||
position: absolute;
|
||||
top: -15px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
background: #818EBD;
|
||||
|
||||
text-align: left;
|
||||
height: 70px;
|
||||
}
|
||||
div#branding {
|
||||
float: left;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
/* end hide */
|
||||
}
|
||||
div#nav div.wrapper {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
This text is from the called class
|
||||
@@ -0,0 +1,14 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Showcase - Tags - UI Tags - Action Tag</title>
|
||||
</head>
|
||||
<body>
|
||||
<b>Example 1:</b>
|
||||
This example calls an action and includes the output on the page
|
||||
<p id="example1" style="background-color:yellow;">
|
||||
<s:action namespace="/tags/ui" name="actionTagExample" executeResult="true"/>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
|
||||
<s:form action="exampleSubmit" enctype="multipart/form-data" javascriptTooltip="true">
|
||||
<s:textfield
|
||||
label="Name"
|
||||
<s:textfield
|
||||
label="Name"
|
||||
name="name"
|
||||
tooltip="Enter your Name here"/>
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
tooltip="Select Your Birthday"
|
||||
label="Birthday"
|
||||
name="birthday" />
|
||||
|
||||
|
||||
<sx:datetimepicker
|
||||
tooltip="Enter the time you wake up"
|
||||
label="Wake up time"
|
||||
name="wakeup"
|
||||
name="wakeup"
|
||||
type="time"/>
|
||||
|
||||
|
||||
<s:textarea
|
||||
tooltip="Enter your Biography"
|
||||
label="Biography"
|
||||
@@ -76,7 +76,7 @@
|
||||
name="region" list="{'North', 'South'}"
|
||||
value="'South'"
|
||||
doubleValue="'Florida'"
|
||||
doubleList="top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}"
|
||||
doubleList="top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}"
|
||||
doubleName="state"
|
||||
headerKey="-1"
|
||||
headerValue="---------- Please Select ----------"
|
||||
@@ -100,35 +100,35 @@
|
||||
|
||||
<s:file
|
||||
tooltip="Upload Your Picture"
|
||||
label="Picture"
|
||||
label="Picture"
|
||||
name="picture" />
|
||||
|
||||
|
||||
<s:optiontransferselect
|
||||
tooltip="Select Your Favourite Cartoon Characters"
|
||||
label="Favourite Cartoons Characters"
|
||||
name="leftSideCartoonCharacters"
|
||||
name="leftSideCartoonCharacters"
|
||||
leftTitle="Left Title"
|
||||
rightTitle="Right Title"
|
||||
list="{'Popeye', 'He-Man', 'Spiderman'}"
|
||||
list="{'Popeye', 'He-Man', 'Spiderman'}"
|
||||
multiple="true"
|
||||
headerKey="headerKey"
|
||||
headerValue="--- Please Select ---"
|
||||
emptyOption="true"
|
||||
doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
|
||||
doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
|
||||
doubleName="rightSideCartoonCharacters"
|
||||
doubleHeaderKey="doubleHeaderKey"
|
||||
doubleHeaderValue="--- Please Select ---"
|
||||
doubleHeaderValue="--- Please Select ---"
|
||||
doubleEmptyOption="true"
|
||||
doubleMultiple="true" />
|
||||
|
||||
|
||||
<s:textarea
|
||||
label="Your Thougths"
|
||||
name="thoughts"
|
||||
name="thoughts"
|
||||
tooltip="Enter your thoughts here" />
|
||||
|
||||
<s:submit onclick="alert('Custom onclick event triggered before submitting form... Press OK to continue!');" />
|
||||
|
||||
<s:submit />
|
||||
<s:reset onclick="alert('Resetting form now... Press OK to continue!');" />
|
||||
</s:form>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>UI Tags</h1>
|
||||
|
||||
|
||||
<ul>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="example" method="input" /><s:a href="%{url}">UI Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="exampleVelocity" method="input" /><s:a href="%{url}">UI Example (Velocity)</s:a></li>
|
||||
@@ -16,8 +16,9 @@
|
||||
<li><s:url var="url" namespace="/tags/ui" action="showDynamicTreeAction"/><s:a href="%{url}">Tree Example (dynamic)</s:a>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="showDynamicAjaxTreeAction"/><s:a href="%{url}">Tree Example (dynamic ajax loading)</s:a>
|
||||
<li><s:url var="url" value="componentTagExample.jsp"/><s:a href="%{#url}">Component Tag Example</s:a>
|
||||
<li><a href="datepicker">DateTime picker tag - Pick a date</a></li>
|
||||
<li><a href="timepicker">DateTime picker tag - Pick a time</a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="actionTagExample" method="input" /><s:a href="%{url}">Action Tag Example</s:a></li>
|
||||
<li><a href="datepicker/index.jsp">DateTime picker tag - Pick a date</a></li>
|
||||
<li><a href="timepicker/index.jsp">DateTime picker tag - Pick a time</a></li>
|
||||
<%--li><s:url var="url" namespace="/tags/ui" action="populateUsingIterator" method="input" /><s:a href="%{url}">UI population using iterator tag</s:a></li--%>
|
||||
</ul>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ActionChainingTest extends ITBaseTest {
|
||||
public void test() {
|
||||
beginAt("/actionchaining/actionChain1!input");
|
||||
assertTextPresent("Action Chain 1 Property 1: Property Set In Action Chain 1");
|
||||
assertTextPresent("Action Chain 2 Property 1: Property Set in Action Chain 2");
|
||||
assertTextPresent("Action Chain 3 Property 1: Property set in Action Chain 3");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ActionTagExampleTest extends ITBaseTest {
|
||||
public void test() {
|
||||
beginAt("/tags/ui/actionTagExample!input.action");
|
||||
assertTextPresent("This text is from the called class");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class CRUDTest extends ITBaseTest {
|
||||
public void testCreate() {
|
||||
beginAt("/skill/edit.action");
|
||||
|
||||
setTextField("currentSkill.name", "somename1");
|
||||
setTextField("currentSkill.description", "somedescription1");
|
||||
|
||||
submit();
|
||||
|
||||
beginAt("/skill/list.action");
|
||||
assertTextPresent("somename1");
|
||||
assertTextPresent("somedescription1");
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ComponentTagExampleTest extends ITBaseTest {
|
||||
public void test() {
|
||||
beginAt("/tags/ui/componentTagExample.jsp");
|
||||
assertTextPresent("Freemarker Custom Template - parameter 'paramName' - paramValue1");
|
||||
assertTextPresent("Freemarker Custom Template - parameter 'paramName' - paramValue4");
|
||||
assertTextPresent("JSP Custom Template - parameter 'paramName' - paramValue2");
|
||||
assertTextPresent("JSP Custom Template - parameter 'paramName' - paramValue3");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ConversionTest extends ITBaseTest {
|
||||
public void testList() {
|
||||
beginAt("/conversion/enterPersonsInfo.action");
|
||||
setTextField("persons[0].name", "name0");
|
||||
setTextField("persons[0].age", "0");
|
||||
setTextField("persons[1].name", "name1");
|
||||
setTextField("persons[1].age", "1");
|
||||
setTextField("persons[2].name", "name2");
|
||||
setTextField("persons[2].age", "2");
|
||||
|
||||
submit();
|
||||
|
||||
assertTextPresent("SET 0 Name: name0");
|
||||
assertTextPresent("SET 0 Age: 0");
|
||||
assertTextPresent("SET 1 Name: name1");
|
||||
assertTextPresent("SET 1 Age: 1");
|
||||
assertTextPresent("SET 2 Name: name2");
|
||||
assertTextPresent("SET 2 Age: 2");
|
||||
}
|
||||
|
||||
public void testSet() {
|
||||
beginAt("/conversion/enterAddressesInfo.action");
|
||||
setTextField("addresses('id0').address", "address0");
|
||||
setTextField("addresses('id1').address", "address1");
|
||||
setTextField("addresses('id2').address", "address2");
|
||||
|
||||
submit();
|
||||
|
||||
assertTextPresent("id0 -> address0");
|
||||
assertTextPresent("id1 -> address1");
|
||||
assertTextPresent("id2 -> address2");
|
||||
}
|
||||
|
||||
public void testEnum() {
|
||||
beginAt("/conversion/enterOperationEnumInfo.action");
|
||||
checkCheckbox("selectedOperations", "ADD");
|
||||
checkCheckbox("selectedOperations", "MINUS");
|
||||
|
||||
submit();
|
||||
|
||||
assertTextPresent("ADD");
|
||||
assertTextPresent("MINUS");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ExecAndWaitTest extends ITBaseTest {
|
||||
public void testNodelay() throws InterruptedException {
|
||||
beginAt("/wait/example1.jsp");
|
||||
|
||||
setTextField("time", "7000");
|
||||
submit();
|
||||
assertTextPresent("We are processing your request. Please wait.");
|
||||
|
||||
//hit it again
|
||||
beginAt("/wait/longProcess1.action?time=1000");
|
||||
assertTextPresent("We are processing your request. Please wait.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
public class FileDownloadTest extends ITBaseTest {
|
||||
public void testImage() throws InterruptedException, MalformedURLException {
|
||||
beginAt("/filedownload/download.action");
|
||||
|
||||
URL url = new URL("http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/src/main/webapp/images/struts.gif");
|
||||
assertDownloadedFileEquals(url);
|
||||
}
|
||||
|
||||
public void testZip() throws InterruptedException, MalformedURLException {
|
||||
beginAt("/filedownload/download2.action");
|
||||
|
||||
URL url = new URL("http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/src/main/webapp/images/struts-gif.zip");
|
||||
assertDownloadedFileEquals(url);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class FreeMarkerManagerTest extends ITBaseTest {
|
||||
public void testCustomManager() {
|
||||
beginAt("/freemarker/customFreemarkerManagerDemo.action");
|
||||
|
||||
String date = getElementTextByXPath("//*[@id='todaysDate']");
|
||||
assertNotNull(date);
|
||||
assertTrue(date.length() > 0);
|
||||
|
||||
String time = getElementTextByXPath("//*[@id='timeNow']");
|
||||
assertNotNull(time);
|
||||
assertTrue(time.length() > 0);
|
||||
}
|
||||
|
||||
public void testTags() {
|
||||
beginAt("/freemarker/standardTags.action");
|
||||
assertElementPresent("test_name");
|
||||
assertElementPresent("test_");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
import net.sourceforge.jwebunit.junit.WebTestCase;
|
||||
|
||||
public abstract class ITBaseTest extends WebTestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ParameterUtils {
|
||||
|
||||
public static String getBaseUrl() {
|
||||
String port = System.getProperty("http.port");
|
||||
if (port == null) {
|
||||
port = "8080";
|
||||
}
|
||||
return "http://localhost:"+port+"/struts2-showcase";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class UITagExampleTest extends ITBaseTest {
|
||||
public void testInputForm() {
|
||||
setScriptingEnabled(false);
|
||||
beginAt("/tags/ui/example!input.action");
|
||||
assertFormPresent("exampleSubmit");
|
||||
// text box
|
||||
assertFormElementPresent("name");
|
||||
// textarea
|
||||
assertFormElementPresent("bio");
|
||||
// select
|
||||
assertFormElementPresent("favouriteColor");
|
||||
// checkbox list
|
||||
assertFormElementPresent("friends");
|
||||
// checkbox
|
||||
assertFormElementPresent("legalAge");
|
||||
|
||||
// set fields
|
||||
setTextField("name", "name");
|
||||
setTextField("bio", "bio");
|
||||
selectOption("favouriteColor", "Red");
|
||||
checkCheckbox("friends", "Patrick");
|
||||
checkCheckbox("friends", "Jason");
|
||||
checkCheckbox("legalAge");
|
||||
|
||||
submit();
|
||||
|
||||
assertTextInElement("name", "name");
|
||||
assertTextInElement("bio", "bio");
|
||||
assertTextInElement("favouriteColor", "Red");
|
||||
assertTextInElement("friends", "[Patrick, Jason]");
|
||||
assertTextInElement("legalAge", "true");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* $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
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 it.org.apache.struts2.showcase;
|
||||
|
||||
public class ValidationTest extends ITBaseTest {
|
||||
public void testFieldValidators() {
|
||||
beginAt("/validation/showFieldValidatorsExamples.action");
|
||||
|
||||
setTextField("integerValidatorField", "nonint");
|
||||
setTextField("dateValidatorField", "nondate");
|
||||
setTextField("emailValidatorField", "!@@#%");
|
||||
setTextField("urlValidatorField", "!@@#%");
|
||||
setTextField("stringLengthValidatorField", "a");
|
||||
setTextField("regexValidatorField", "abc");
|
||||
setTextField("fieldExpressionValidatorField", "abc");
|
||||
|
||||
submit();
|
||||
|
||||
assertTextPresent("Invalid field value for field \"dateValidatorField\"");
|
||||
assertTextPresent("Invalid field value for field \"integerValidatorField\"");
|
||||
assertTextPresent("required and must be string");
|
||||
assertTextPresent("must be a valid email if supplied");
|
||||
assertTextPresent("must be a valid url if supplied ");
|
||||
assertTextPresent("must be a String of a specific greater than 1 less than 5 if specified ");
|
||||
assertTextPresent("regexValidatorField must match a regexp (.*\\.txt) if specified ");
|
||||
assertTextPresent("must be the same as the Required Validator Field if specified ");
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package it.org.apache.struts2.showcase.staticcontent;
|
||||
|
||||
import it.org.apache.struts2.showcase.ITBaseTest;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sourceforge.jwebunit.exception.TestingEngineResponseException;
|
||||
|
||||
public class StaticContentTest extends ITBaseTest {
|
||||
|
||||
public void testInvalidRersources1() throws IOException {
|
||||
try {
|
||||
beginAt("/struts..");
|
||||
fail("Previous request should have failed");
|
||||
} catch (TestingEngineResponseException ex) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
public void testInvalidRersources2() throws IOException {
|
||||
try {
|
||||
beginAt("/struts/..%252f");
|
||||
fail("Previous request should have failed");
|
||||
} catch (TestingEngineResponseException ex) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
/*public void testInvalidRersources3() throws IOException {
|
||||
try {
|
||||
beginAt("/struts/..%252f..%252f..%252fWEB-INF/classes/org/apache/struts2/showcase/action/EmployeeAction.class/");
|
||||
fail("Previous request should have failed");
|
||||
} catch (TestingEngineResponseException ex) {
|
||||
// ok
|
||||
}
|
||||
}*/
|
||||
}
|
||||
+218
-148
@@ -1,26 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright 2005-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.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-assembly</artifactId>
|
||||
@@ -33,16 +11,160 @@
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/assembly</connection>
|
||||
<developerConnection>
|
||||
scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/assembly</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/assembly</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/assembly</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/assembly</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/assembly</url>
|
||||
</scm>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>j4</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2-beta-1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attached</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/all.xml</descriptor>
|
||||
<descriptor>src/main/assembly/lib.xml</descriptor>
|
||||
<descriptor>src/main/assembly/lib-jdk14.xml</descriptor>
|
||||
<descriptor>src/main/assembly/apps.xml</descriptor>
|
||||
<descriptor>src/main/assembly/src.xml</descriptor>
|
||||
<descriptor>src/main/assembly/docs.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>struts-${version}</finalName>
|
||||
<outputDirectory>target/assembly/out</outputDirectory>
|
||||
<workDirectory>target/assembly/work</workDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!-- Backported JDK 1.4 jars -->
|
||||
<dependency>
|
||||
<groupId>net.sf.retrotranslator</groupId>
|
||||
<artifactId>retrotranslator-runtime</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>backport-util-concurrent</groupId>
|
||||
<artifactId>backport-util-concurrent</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<type>jar</type>
|
||||
<classifier>jdk14</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-config-browser-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jasperreports-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jfreechart-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jsf-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-pell-multipart-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plexus-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-struts1-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
@@ -109,7 +231,7 @@
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<classifier>javadoc</classifier>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
<outputDirectory>${project.build.directory}/xwork-apidocs</outputDirectory>
|
||||
@@ -125,12 +247,9 @@
|
||||
<phase>process-resources</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<mkdir dir="${project.build.directory}/cwiki"/>
|
||||
<get src="http://struts.apache.org/2.x/docs.zip"
|
||||
dest="${project.build.directory}/docs.zip"
|
||||
ignoreerrors="false"/>
|
||||
<unzip src="${project.build.directory}/docs.zip"
|
||||
dest="${project.build.directory}/cwiki"/>
|
||||
<mkdir dir="${project.build.directory}/cwiki" />
|
||||
<get src="http://struts.apache.org/2.x/docs.zip" dest="${project.build.directory}/docs.zip" ignoreerrors="false" />
|
||||
<unzip src="${project.build.directory}/docs.zip" dest="${project.build.directory}/cwiki" />
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
@@ -142,11 +261,19 @@
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2-beta-1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attached</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/all.xml</descriptor>
|
||||
<descriptor>src/main/assembly/lib.xml</descriptor>
|
||||
<descriptor>src/main/assembly/lib-jdk14.xml</descriptor>
|
||||
<descriptor>src/main/assembly/apps.xml</descriptor>
|
||||
<descriptor>src/main/assembly/src.xml</descriptor>
|
||||
<descriptor>src/main/assembly/docs.xml</descriptor>
|
||||
@@ -161,6 +288,23 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-codebehind-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-convention-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-javatemplates-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
@@ -168,6 +312,18 @@
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dojo-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dwr-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jasperreports-plugin</artifactId>
|
||||
@@ -186,6 +342,12 @@
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-junit-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-pell-multipart-plugin</artifactId>
|
||||
@@ -200,15 +362,32 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<artifactId>struts2-portlet-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-spring-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
@@ -218,125 +397,16 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
<artifactId>struts2-testng-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Backported JDK 1.4 jars -->
|
||||
<dependency>
|
||||
<groupId>net.sf.retrotranslator</groupId>
|
||||
<artifactId>retrotranslator-runtime</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>backport-util-concurrent</groupId>
|
||||
<artifactId>backport-util-concurrent</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<type>jar</type>
|
||||
<classifier>jdk14</classifier>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-config-browser-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jasperreports-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jfreechart-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jsf-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-pell-multipart-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-plexus-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitegraph-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-sitemesh-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-struts1-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-tiles-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-rest-plugin</artifactId>
|
||||
<version>${version}</version>
|
||||
<classifier>jdk14</classifier>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
@@ -127,6 +127,14 @@
|
||||
<directory>../plugins/codebehind/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-codebehind-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/codebehind/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-javatemplates-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/convention/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-convention-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/config-browser/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-config-browser-plugin</outputDirectory>
|
||||
@@ -135,6 +143,10 @@
|
||||
<directory>../plugins/dojo/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-dojo-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/dojo/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-dwr-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/jasperreports/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-jasperreports-plugin</outputDirectory>
|
||||
@@ -147,6 +159,10 @@
|
||||
<directory>../plugins/jsf/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-jsf-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/junit/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-junit-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/pell-multipart/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-pell-multipart-plugin</outputDirectory>
|
||||
@@ -179,6 +195,10 @@
|
||||
<directory>../plugins/sitemesh/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-sitemesh-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/testng/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-testng-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/tiles/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-tiles-plugin</outputDirectory>
|
||||
|
||||
@@ -67,6 +67,10 @@
|
||||
<directory>../plugins/dojo/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-dojo-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/dojo/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-dwr-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/jasperreports/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-jasperreports-plugin</outputDirectory>
|
||||
@@ -79,6 +83,10 @@
|
||||
<directory>../plugins/jsf/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-jsf-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/junit/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-junit-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/pell-multipart/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-pell-multipart-plugin</outputDirectory>
|
||||
@@ -111,6 +119,10 @@
|
||||
<directory>../plugins/sitemesh/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-sitemesh-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/testng/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-testng-plugin</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../plugins/tiles/target/site</directory>
|
||||
<outputDirectory>docs/struts2-plugins/struts2-tiles-plugin</outputDirectory>
|
||||
|
||||
+9
-12
@@ -21,13 +21,12 @@
|
||||
* under the License.
|
||||
*/
|
||||
-->
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-parent</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.4</version>
|
||||
</parent>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-core</artifactId>
|
||||
@@ -35,9 +34,9 @@
|
||||
<name>Struts 2 Core</name>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/core/</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/core/</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/core/</url>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/core</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_1_4/core</developerConnection>
|
||||
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_1_4/core</url>
|
||||
</scm>
|
||||
|
||||
<build>
|
||||
@@ -57,7 +56,7 @@
|
||||
<artifactItem>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
<classifier>sources</classifier>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
@@ -130,7 +129,6 @@
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>rat-maven-plugin</artifactId>
|
||||
@@ -145,10 +143,10 @@
|
||||
<exclude>src/main/resources/org/apache/struts2/static/domTT.js</exclude>
|
||||
<exclude>src/test/resources/org/apache/struts2/interceptor/validation/*</exclude>
|
||||
<exclude>src/site/resources/tags/**</exclude>
|
||||
<exclude>src/main/resources/*LICENSE.txt</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
@@ -231,7 +229,7 @@
|
||||
<dependency>
|
||||
<groupId>com.opensymphony</groupId>
|
||||
<artifactId>xwork</artifactId>
|
||||
<version>2.1.1</version>
|
||||
<version>2.1.2</version>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>-->
|
||||
@@ -243,7 +241,7 @@
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.12</version>
|
||||
<version>2.3.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -394,7 +392,6 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts-annotations</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2;
|
||||
|
||||
import org.apache.struts2.dispatcher.mapper.CompositeActionMapper;
|
||||
@@ -99,7 +100,7 @@ public final class StrutsConstants {
|
||||
/** List of Velocity context names */
|
||||
public static final String STRUTS_VELOCITY_CONTEXTS = "struts.velocity.contexts";
|
||||
|
||||
/** The directory containing UI templates */
|
||||
/** The directory containing UI templates. All templates must reside in this directory. */
|
||||
public static final String STRUTS_UI_TEMPLATEDIR = "struts.ui.templateDir";
|
||||
|
||||
/** The default UI template theme */
|
||||
@@ -117,9 +118,15 @@ public final class StrutsConstants {
|
||||
*/
|
||||
public static final String STRUTS_MULTIPART_PARSER = "struts.multipart.parser";
|
||||
|
||||
/** Whether Spring should autoWire or not */
|
||||
/** How Spring should autowire. Valid values are 'name', 'type', 'auto', and 'constructor' */
|
||||
public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE = "struts.objectFactory.spring.autoWire";
|
||||
|
||||
/** Whether the autowire strategy chosen by STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE is always respected. Defaults
|
||||
* to false, which is the legacy behavior that tries to determine the best strategy for the situation.
|
||||
* @since 2.1.3
|
||||
*/
|
||||
public static final String STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE_ALWAYS_RESPECT = "struts.objectFactory.spring.autoWire.alwaysRespect";
|
||||
|
||||
/** Whether Spring should use its class cache or not */
|
||||
public static final String STRUTS_OBJECTFACTORY_SPRING_USE_CLASS_CACHE = "struts.objectFactory.spring.useClassCache";
|
||||
|
||||
@@ -183,4 +190,9 @@ public final class StrutsConstants {
|
||||
/** The {@link com.opensymphony.xwork2.util.PatternMatcher} implementation class */
|
||||
public static final String STRUTS_PATTERNMATCHER = "struts.patternMatcher";
|
||||
|
||||
/** The {@link org.apache.struts2.dispatcher.StaticContentLoader} implementation class */
|
||||
public static final String STRUTS_STATIC_CONTENT_LOADER = "struts.staticContentLoader";
|
||||
|
||||
/** The {@link com.opensymphony.xwork2.UnknownHandlerManager} implementation class */
|
||||
public static final String STRUTS_UNKNOWN_HANDLER_MANAGER = "struts.unknownHandlerManager";
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2;
|
||||
|
||||
import com.opensymphony.xwork2.XWorkException;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2;
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -44,6 +45,7 @@ import org.apache.struts2.views.jsp.TagUtils;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.ActionProxyFactory;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
@@ -189,7 +191,7 @@ public class ActionComponent extends ContextBean {
|
||||
Map application = ctx.getApplication();
|
||||
|
||||
Dispatcher du = Dispatcher.getInstance();
|
||||
Map extraContext = du.createContextMap(new RequestMap(req),
|
||||
Map<String, Object> extraContext = du.createContextMap(new RequestMap(req),
|
||||
newParams,
|
||||
session,
|
||||
application,
|
||||
@@ -278,6 +280,7 @@ public class ActionComponent extends ContextBean {
|
||||
// get the old value stack from the request
|
||||
ValueStack stack = getStack();
|
||||
// execute at this point, after params have been set
|
||||
ActionInvocation inv = ActionContext.getContext().getActionInvocation();
|
||||
try {
|
||||
|
||||
proxy = actionProxyFactory.createActionProxy(namespace, actionName, methodName, createExtraContext(), executeResult, true);
|
||||
@@ -291,6 +294,9 @@ public class ActionComponent extends ContextBean {
|
||||
} finally {
|
||||
// set the old stack back on the request
|
||||
req.setAttribute(ServletActionContext.STRUTS_VALUESTACK_KEY, stack);
|
||||
if (inv != null) {
|
||||
ActionContext.getContext().setActionInvocation(inv);
|
||||
}
|
||||
}
|
||||
|
||||
if ((getVar() != null) && (proxy != null)) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -242,25 +243,84 @@ public class Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (altSyntax()) {
|
||||
// does the expression start with %{ and end with }? if so, just cut it off!
|
||||
if (expr.startsWith("%{") && expr.endsWith("}")) {
|
||||
expr = expr.substring(2, expr.length() - 1);
|
||||
}
|
||||
}
|
||||
expr = stripExpressionIfAltSyntax(expr);
|
||||
|
||||
return getStack().findValue(expr);
|
||||
}
|
||||
|
||||
/**
|
||||
* If altsyntax (%{...}) is applied, simply strip the "%{" and "}" off.
|
||||
* @param expr the expression (must be not null)
|
||||
* @return the stripped expression if altSyntax is enabled. Otherwise
|
||||
* the parameter expression is returned as is.
|
||||
*/
|
||||
protected String stripExpressionIfAltSyntax(String expr) {
|
||||
return stripExpressionIfAltSyntax(stack, expr);
|
||||
}
|
||||
|
||||
/**
|
||||
* If altsyntax (%{...}) is applied, simply strip the "%{" and "}" off.
|
||||
* @param stack the ValueStack where the context value is searched for.
|
||||
* @param expr the expression (must be not null)
|
||||
* @return the stripped expression if altSyntax is enabled. Otherwise
|
||||
* the parameter expression is returned as is.
|
||||
*/
|
||||
public static String stripExpressionIfAltSyntax(ValueStack stack, String expr) {
|
||||
if (altSyntax(stack)) {
|
||||
// does the expression start with %{ and end with }? if so, just cut it off!
|
||||
if (expr.startsWith("%{") && expr.endsWith("}")) {
|
||||
return expr.substring(2, expr.length() - 1);
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the altSyntax enabled? [TRUE]
|
||||
* <p/>
|
||||
* @param stack the ValueStack where the context value is searched for.
|
||||
* @return true if altSyntax is activated. False otherwise.
|
||||
* See <code>struts.properties</code> where the altSyntax flag is defined.
|
||||
*/
|
||||
public static boolean altSyntax(ValueStack stack) {
|
||||
return ContextUtil.isUseAltSyntax(stack.getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the altSyntax enabled? [TRUE]
|
||||
* <p/>
|
||||
* See <code>struts.properties</code> where the altSyntax flag is defined.
|
||||
*/
|
||||
public boolean altSyntax() {
|
||||
return ContextUtil.isUseAltSyntax(stack.getContext());
|
||||
return altSyntax(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the sorrounding %{ } to the expression for proper processing.
|
||||
* @param expr the expression.
|
||||
* @return the modified expression if altSyntax is enabled, or the parameter
|
||||
* expression otherwise.
|
||||
*/
|
||||
protected String completeExpressionIfAltSyntax(String expr) {
|
||||
if (altSyntax()) {
|
||||
return "%{" + expr + "}";
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* This check is needed for backwards compatibility with 2.1.x
|
||||
* @param expr the expression.
|
||||
* @return the found string if altSyntax is enabled. The parameter
|
||||
* expression otherwise.
|
||||
*/
|
||||
protected String findStringIfAltSyntax(String expr) {
|
||||
if (altSyntax()) {
|
||||
return findString(expr);
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the OGNL stack to find an Object value.
|
||||
* <p/>
|
||||
@@ -308,14 +368,9 @@ public class Component {
|
||||
*/
|
||||
protected Object findValue(String expr, Class toType) {
|
||||
if (altSyntax() && toType == String.class) {
|
||||
return TextParseUtil.translateVariables('%', expr, stack);
|
||||
return TextParseUtil.translateVariables('%', expr, stack);
|
||||
} else {
|
||||
if (altSyntax()) {
|
||||
// does the expression start with %{ and end with }? if so, just cut it off!
|
||||
if (expr.startsWith("%{") && expr.endsWith("}")) {
|
||||
expr = expr.substring(2, expr.length() - 1);
|
||||
}
|
||||
}
|
||||
expr = stripExpressionIfAltSyntax(expr);
|
||||
|
||||
return getStack().findValue(expr, toType);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -218,7 +219,7 @@ public class Date extends ContextBean {
|
||||
*/
|
||||
public String formatTime(TextProvider tp, java.util.Date date) {
|
||||
java.util.Date now = new java.util.Date();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List args = new ArrayList();
|
||||
long secs = Math.abs((now.getTime() - date.getTime()) / 1000);
|
||||
long mins = secs / 60;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -142,13 +143,7 @@ public abstract class DoubleListUIBean extends ListUIBean {
|
||||
}
|
||||
|
||||
if (doubleListValue != null) {
|
||||
if (altSyntax()) {
|
||||
// the same logic as with findValue(String)
|
||||
// if value start with %{ and end with }, just cut it off!
|
||||
if (doubleListValue.startsWith("%{") && doubleListValue.endsWith("}")) {
|
||||
doubleListValue = doubleListValue.substring(2, doubleListValue.length() - 1);
|
||||
}
|
||||
}
|
||||
doubleListValue = stripExpressionIfAltSyntax(doubleListValue);
|
||||
|
||||
addParameter("doubleListValue", doubleListValue);
|
||||
}else if (tmpDoubleList instanceof Map) {
|
||||
@@ -185,11 +180,7 @@ public abstract class DoubleListUIBean extends ListUIBean {
|
||||
Form form = (Form) findAncestor(Form.class);
|
||||
if (doubleId != null) {
|
||||
// this check is needed for backwards compatibility with 2.1.x
|
||||
if (altSyntax()) {
|
||||
addParameter("doubleId", findString(doubleId));
|
||||
} else {
|
||||
addParameter("doubleId", doubleId);
|
||||
}
|
||||
addParameter("doubleId", findStringIfAltSyntax(doubleId));
|
||||
} else if (form != null) {
|
||||
addParameter("doubleId", form.getParameters().get("id") + "_" +escape(this.doubleName));
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,18 +18,18 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import org.apache.struts2.components.Param.UnnamedParametric;
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.views.annotations.StrutsTagAttribute;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.struts2.views.annotations.StrutsTag;
|
||||
import org.apache.struts2.components.Param.UnnamedParametric;
|
||||
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
@@ -65,6 +65,10 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* ....
|
||||
* </s:form>
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* <s:fielderror fieldName="field1" />
|
||||
*
|
||||
* <!-- END SNIPPET: example -->
|
||||
* </pre>
|
||||
*
|
||||
@@ -86,7 +90,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
"or partial depending on param tag nested)if they exists")
|
||||
public class FieldError extends UIBean implements UnnamedParametric {
|
||||
|
||||
private List errorFieldNames = new ArrayList();
|
||||
private List<String> errorFieldNames = new ArrayList<String>();
|
||||
|
||||
public FieldError(ValueStack stack, HttpServletRequest request, HttpServletResponse response) {
|
||||
super(stack, request, response);
|
||||
@@ -98,14 +102,27 @@ public class FieldError extends UIBean implements UnnamedParametric {
|
||||
return TEMPLATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void evaluateExtraParams() {
|
||||
super.evaluateExtraParams();
|
||||
|
||||
if (errorFieldNames != null)
|
||||
addParameter("errorFieldNames", errorFieldNames);
|
||||
}
|
||||
|
||||
public void addParameter(Object value) {
|
||||
if (value != null) {
|
||||
errorFieldNames.add(value.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public List getFieldErrorFieldNames() {
|
||||
public List<String> getFieldErrorFieldNames() {
|
||||
return errorFieldNames;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Field name for single field attribute usage", type="String")
|
||||
public void setFieldName(String fieldName) {
|
||||
addParameter(fieldName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
@@ -92,6 +93,7 @@ public class Form extends ClosingUIBean {
|
||||
private int sequence = 0;
|
||||
|
||||
protected String onsubmit;
|
||||
protected String onreset;
|
||||
protected String action;
|
||||
protected String target;
|
||||
protected String enctype;
|
||||
@@ -102,7 +104,7 @@ public class Form extends ClosingUIBean {
|
||||
protected String windowState;
|
||||
protected String acceptcharset;
|
||||
protected String focusElement;
|
||||
|
||||
|
||||
protected Configuration configuration;
|
||||
protected ObjectFactory objectFactory;
|
||||
protected UrlRenderer urlRenderer;
|
||||
@@ -133,12 +135,12 @@ public class Form extends ClosingUIBean {
|
||||
public void setObjectFactory(ObjectFactory objectFactory) {
|
||||
this.objectFactory = objectFactory;
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
public void setUrlRenderer(UrlRenderer urlRenderer) {
|
||||
this.urlRenderer = urlRenderer;
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
public void setActionValidatorManager(ActionValidatorManager mgr) {
|
||||
this.actionValidatorManager = mgr;
|
||||
@@ -177,6 +179,10 @@ public class Form extends ClosingUIBean {
|
||||
addParameter("onsubmit", findString(onsubmit));
|
||||
}
|
||||
|
||||
if (onreset != null) {
|
||||
addParameter("onreset", findString(onreset));
|
||||
}
|
||||
|
||||
if (target != null) {
|
||||
addParameter("target", findString(target));
|
||||
}
|
||||
@@ -199,7 +205,7 @@ public class Form extends ClosingUIBean {
|
||||
// we have this if check so we don't do this twice (on open and close of the template)
|
||||
addParameter("tagNames", new ArrayList());
|
||||
}
|
||||
|
||||
|
||||
if (focusElement != null) {
|
||||
addParameter("focusElement", findString(focusElement));
|
||||
}
|
||||
@@ -294,6 +300,11 @@ public class Form extends ClosingUIBean {
|
||||
this.onsubmit = onsubmit;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="HTML onreset attribute")
|
||||
public void setOnreset(String onreset) {
|
||||
this.onreset = onreset;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Set action name to submit to, without .action suffix", defaultValue="current action")
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -33,7 +34,7 @@ import com.opensymphony.xwork2.inject.Inject;
|
||||
/**
|
||||
* FormButton.
|
||||
*/
|
||||
public abstract class FormButton extends UIBean {
|
||||
public abstract class FormButton extends ClosingUIBean {
|
||||
|
||||
static final String BUTTONTYPE_INPUT = "input";
|
||||
static final String BUTTONTYPE_BUTTON = "button";
|
||||
@@ -110,11 +111,7 @@ public abstract class FormButton extends UIBean {
|
||||
String _tmp_id = "";
|
||||
if (id != null) {
|
||||
// this check is needed for backwards compatibility with 2.1.x
|
||||
if (altSyntax()) {
|
||||
_tmp_id = findString(id);
|
||||
} else {
|
||||
_tmp_id = id;
|
||||
}
|
||||
_tmp_id = findStringIfAltSyntax(id);
|
||||
}
|
||||
else {
|
||||
if (form != null && form.getParameters().get("id") != null) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -123,7 +124,7 @@ public class Include extends Component {
|
||||
|
||||
public boolean end(Writer writer, String body) {
|
||||
String page = findString(value, "value", "You must specify the URL to include. Example: /foo.jsp");
|
||||
StringBuffer urlBuf = new StringBuffer();
|
||||
StringBuilder urlBuf = new StringBuilder();
|
||||
|
||||
// Add URL
|
||||
urlBuf.append(page);
|
||||
@@ -211,7 +212,7 @@ public class Include extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer flatPathBuffer = new StringBuffer();
|
||||
StringBuilder flatPathBuffer = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < stack.size(); i++) {
|
||||
flatPathBuffer.append("/").append(stack.elementAt(i));
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
@@ -33,16 +34,16 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
/**
|
||||
* <!-- START SNIPPET: javadoc -->
|
||||
*
|
||||
* <p>Iterator will iterate over a value. An iterable value can be either of: java.util.Collection, java.util.Iterator,
|
||||
* java.util.Enumeration, java.util.Map, array.</p> <p/> <!-- END SNIPPET: javadoc -->
|
||||
* <p>Iterator will iterate over a value. An iterable value can be any of: java.util.Collection, java.util.Iterator,
|
||||
* java.util.Enumeration, java.util.Map, or an array.</p> <p/> <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
* <!-- START SNIPPET: params -->
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li>status (String) - if specified, an instanceof IteratorStatus will be pushed into stack upon each iteration</li>
|
||||
* <li>status (String) - if specified, an instance of IteratorStatus will be pushed into stack upon each iteration</li>
|
||||
*
|
||||
* <li>value (Object) - the source to iterate over, must be iteratable, else an the object itself will be put into a
|
||||
* <li>value (Object) - the source to iterate over, must be iteratable, else the object itself will be put into a
|
||||
* newly created List (see MakeIterator#convert(Object)</li>
|
||||
*
|
||||
* <li>id (String) - if specified the current iteration object will be place with this id in Struts stack's context
|
||||
@@ -72,7 +73,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* <p>The following example uses a {@link Bean} tag and places it into the ActionContext. The iterator tag will retrieve
|
||||
* that object from the ActionContext and then calls its getDays() method as above. The status attribute is also used to
|
||||
* create a {@link IteratorStatus} object, which in this example, its odd() method is used to alternate row
|
||||
* create an {@link IteratorStatus} object, which in this example, its odd() method is used to alternate row
|
||||
* colours:</p>
|
||||
*
|
||||
* <!-- END SNIPPET: example2description -->
|
||||
@@ -110,7 +111,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* <p> The next example will further demonstrate the use of the status attribute, using a DAO obtained from the action
|
||||
* class through OGNL, iterating over groups and their users (in a security context). The last() method indicates if the
|
||||
* current object is the last available in the iteration, and if not, we need to seperate the users using a comma: </p>
|
||||
* current object is the last available in the iteration, and if not, we need to separate the users using a comma: </p>
|
||||
*
|
||||
* <!-- END SNIPPET: example3description -->
|
||||
*
|
||||
@@ -174,13 +175,32 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
* <s:property value="#stat.index" />
|
||||
*
|
||||
* <!-- grab the top of the stack which should be the -->
|
||||
* <!-- current iteration value (0, 1, ... 5) -->
|
||||
* <!-- current iteration value (1, ... 5) -->
|
||||
* <s:property value="top" />
|
||||
* </s:iterator>
|
||||
*
|
||||
* <!-- END SNIPPET: example5code -->
|
||||
* </pre>
|
||||
*
|
||||
* <!-- START SNIPPET: example6description -->
|
||||
*
|
||||
* </p>Another way to create a simple loop, similar to JSTL's
|
||||
* <c:forEach begin="..." end="..." ...> is to use some
|
||||
* OGNL magic, which provides some under-the-covers magic to
|
||||
* make 0-n loops trivial. This example also loops five times.
|
||||
*
|
||||
* <!-- END SNIPPET: example6description -->
|
||||
*
|
||||
* <pre>
|
||||
* <!-- START SNIPPET: example6code -->
|
||||
*
|
||||
* <s:iterator status="stat" value="(5).{ #this }" >
|
||||
* <s:property value="#stat.count" /> <!-- Note that "count" is 1-based, "index" is 0-based. -->
|
||||
* </s:iterator>
|
||||
*
|
||||
* <!-- END SNIPPET: example6code -->
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@StrutsTag(name="iterator", tldTagClass="org.apache.struts2.views.jsp.IteratorTag", description="Iterate over a iterable value")
|
||||
public class IteratorComponent extends ContextBean {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -87,10 +88,7 @@ public class Label extends UIBean {
|
||||
String providedLabel = TextProviderHelper.getText(key, key, stack);
|
||||
addParameter("nameValue", providedLabel);
|
||||
} else if (name != null) {
|
||||
String expr = name;
|
||||
if (altSyntax()) {
|
||||
expr = "%{" + expr + "}";
|
||||
}
|
||||
String expr = completeExpressionIfAltSyntax(name);
|
||||
addParameter("nameValue", findString(expr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
@@ -42,7 +43,7 @@ import com.opensymphony.xwork2.util.ValueStack;
|
||||
*
|
||||
* Note that the listkey and listvalue attribute will default to "key" and "value"
|
||||
* respectively only when the list attribute is evaluated to a Map or its decendant.
|
||||
* Other thing else, will result in listkey and listvalue to be null and not used.
|
||||
* Everything else will result in listkey and listvalue to be null and not used.
|
||||
*
|
||||
* <!-- END SNIPPET: javadoc -->
|
||||
*
|
||||
@@ -102,19 +103,14 @@ public abstract class ListUIBean extends UIBean {
|
||||
}
|
||||
|
||||
if (listKey != null) {
|
||||
listKey = stripExpressionIfAltSyntax(listKey);
|
||||
addParameter("listKey", listKey);
|
||||
} else if (value instanceof Map) {
|
||||
addParameter("listKey", "key");
|
||||
}
|
||||
|
||||
if (listValue != null) {
|
||||
if (altSyntax()) {
|
||||
// the same logic as with findValue(String)
|
||||
// if value start with %{ and end with }, just cut it off!
|
||||
if (listValue.startsWith("%{") && listValue.endsWith("}")) {
|
||||
listValue = listValue.substring(2, listValue.length() - 1);
|
||||
}
|
||||
}
|
||||
listValue = stripExpressionIfAltSyntax(listValue);
|
||||
addParameter("listValue", listValue);
|
||||
} else if (value instanceof Map) {
|
||||
addParameter("listValue", "value");
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -98,6 +99,7 @@ public class Property extends Component {
|
||||
private String defaultValue;
|
||||
private String value;
|
||||
private boolean escape = true;
|
||||
private boolean escapeJavaScript = false;
|
||||
|
||||
@StrutsTagAttribute(description="The default value to be used if <u>value</u> attribute is null")
|
||||
public void setDefault(String defaultValue) {
|
||||
@@ -109,6 +111,11 @@ public class Property extends Component {
|
||||
this.escape = escape;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Whether to escape Javascript", type="Boolean", defaultValue="false")
|
||||
public void setEscapeJavaScript(boolean escapeJavaScript) {
|
||||
this.escapeJavaScript = escapeJavaScript;
|
||||
}
|
||||
|
||||
@StrutsTagAttribute(description="Value to be displayed", type="Object", defaultValue="<top of stack>")
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
@@ -122,12 +129,8 @@ public class Property extends Component {
|
||||
if (value == null) {
|
||||
value = "top";
|
||||
}
|
||||
else if (altSyntax()) {
|
||||
// the same logic as with findValue(String)
|
||||
// if value start with %{ and end with }, just cut it off!
|
||||
if (value.startsWith("%{") && value.endsWith("}")) {
|
||||
value = value.substring(2, value.length() - 1);
|
||||
}
|
||||
else {
|
||||
value = stripExpressionIfAltSyntax(value);
|
||||
}
|
||||
|
||||
// exception: don't call findString(), since we don't want the
|
||||
@@ -149,10 +152,13 @@ public class Property extends Component {
|
||||
}
|
||||
|
||||
private String prepare(String value) {
|
||||
String result = value;
|
||||
if (escape) {
|
||||
return TextUtils.htmlEncode(value);
|
||||
} else {
|
||||
return value;
|
||||
result = TextUtils.htmlEncode(result);
|
||||
}
|
||||
if (escapeJavaScript) {
|
||||
result = TextUtils.escapeJavaScript(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import java.io.Writer;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -73,6 +74,9 @@ public class Reset extends FormButton {
|
||||
super(stack, request, response);
|
||||
}
|
||||
|
||||
public String getDefaultOpenTemplate() {
|
||||
return "empty";
|
||||
}
|
||||
protected String getDefaultTemplate() {
|
||||
return Reset.TEMPLATE;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.struts2.components;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user