Compare commits

..

2 Commits

Author SHA1 Message Date
René Gielen 676a011b4f Fixed ignores
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4@1368890 13f79535-47bb-0310-9956-ffa450edef68
2012-08-03 11:15:11 +00:00
Lukasz Lenart 954c21481f [maven-release-plugin] copy for tag STRUTS_2_3_4
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4@1337582 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 16:06:38 +00:00
1694 changed files with 39393 additions and 141209 deletions
-70
View File
@@ -1,70 +0,0 @@
# IDEA
.idea
*.iml
*.ipr
*.iws
# Eclipse
.classpath
.project
.settings/
# OSX
.DS_Store
# Scripts
*.sh
# Maven
core/target
xwork-core/target
archetypes/struts2-archetype-angularjs/target
archetypes/struts2-archetype-blank/target
archetypes/struts2-archetype-convention/target
archetypes/struts2-archetype-dbportlet/target
archetypes/struts2-archetype-plugin/target
archetypes/struts2-archetype-portlet/target
archetypes/struts2-archetype-starter/target
archetypes/target
plugins/convention/target
plugins/embeddedjsp/target
plugins/dojo/target
plugins/osgi/target
plugins/cdi/target
plugins/codebehind/target
plugins/spring/target
plugins/jfreechart/target
apps/rest-showcase/target
apps/mailreader/target
apps/portlet/target
apps/blank/target
apps/jboss-blank/target
apps/mailreader/target
apps/portlet/target
apps/showcase/target
apps/target
bundles/admin/target
plugins/config-browser/target
plugins/jasperreports/target
plugins/jsf/target
plugins/json/target
plugins/portlet-tiles/target
plugins/portlet/target
plugins/sitegraph/target
plugins/sitemesh/target
plugins/struts1/target
plugins/tiles3/target
plugins/javatemplates/target
bundles/demo/target
plugins/rest/target
plugins/plexus/target
plugins/testng/target
plugins/dwr/target
plugins/gxp/target
plugins/oval/target
plugins/junit/target
plugins/tiles/target
bundles/target
plugins/target
target
plugins/testng/test-output
+1 -7
View File
@@ -7,10 +7,4 @@ For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.
----------------------------------------------------------------------------
+15 -20
View File
@@ -26,12 +26,18 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-blank</artifactId>
<packaging>war</packaging>
<name>Struts 2 Blank Webapp</name>
<name>Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/blank</url>
</scm>
<dependencies>
@@ -47,19 +53,10 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -68,21 +65,19 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<scanIntervalSeconds>10</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
<scanTarget>src/main/resources/struts.xml</scanTarget>
<scanTarget>src/main/resources/example.xml</scanTarget>
</scanTargets>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
+7 -6
View File
@@ -21,18 +21,19 @@
package example;
import org.apache.struts2.interceptor.validation.SkipValidation;
public class Login extends ExampleSupport {
@Override
public String execute() throws Exception {
if (isInvalid(getUsername())) return INPUT;
if (isInvalid(getPassword())) return INPUT;
return SUCCESS;
}
@SkipValidation
public String form() throws Exception {
return INPUT;
private boolean isInvalid(String value) {
return (value == null || value.length() == 0);
}
private String username;
+3 -3
View File
@@ -8,16 +8,16 @@
<package name="example" namespace="/example" extends="default">
<action name="HelloWorld" class="example.HelloWorld">
<result>/WEB-INF/jsp/example/HelloWorld.jsp</result>
<result>/example/HelloWorld.jsp</result>
</action>
<action name="Login_*" method="{1}" class="example.Login">
<result name="input">/WEB-INF/jsp/example/Login.jsp</result>
<result name="input">/example/Login.jsp</result>
<result type="redirectAction">Menu</result>
</action>
<action name="*" class="example.ExampleSupport">
<result>/WEB-INF/jsp/example/{1}.jsp</result>
<result>/example/{1}.jsp</result>
</action>
<!-- Add actions here -->
@@ -1,26 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
log4j.logger.com.opensymphony.xwork2=DEBUG
log4j.logger.org.apache.struts2=DEBUG
+2 -2
View File
@@ -6,14 +6,14 @@
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<constant name="struts.devMode" value="false" />
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<global-results>
<result name="error">/WEB-INF/jsp/error.jsp</result>
<result name="error">/error.jsp</result>
</global-results>
<global-exception-mappings>
+1 -20
View File
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts Blank</display-name>
@@ -19,21 +17,4 @@
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>
</web-app>
@@ -21,9 +21,11 @@
package example;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.StrutsTestCase;
import com.opensymphony.xwork2.ActionSupport;
import junit.framework.TestCase;
public class HelloWorldTest extends StrutsTestCase {
public void testHelloWorld() throws Exception {
+1 -7
View File
@@ -7,10 +7,4 @@ For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.
----------------------------------------------------------------------------
+11 -7
View File
@@ -26,12 +26,18 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jboss-blank</artifactId>
<packaging>war</packaging>
<name>Struts 2 JBoss Blank Webapp</name>
<name>JBoss Blank Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/jboss-blank</url>
</scm>
<dependencies>
@@ -51,11 +57,9 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
</project>
@@ -8,16 +8,16 @@
<package name="example" namespace="/example" extends="struts-default">
<action name="HelloWorld" class="example.HelloWorld">
<result>/WEB-INF/jsp/example/HelloWorld.jsp</result>
<result>/example/HelloWorld.jsp</result>
</action>
<action name="Login_*" method="{1}" class="example.Login">
<result name="input">/WEB-INF/jsp/example/Login.jsp</result>
<result name="input">/example/Login.jsp</result>
<result type="redirectAction">Menu</result>
</action>
<action name="*" class="example.ExampleSupport">
<result>/WEB-INF/jsp/example/{1}.jsp</result>
<result>/example/{1}.jsp</result>
</action>
<!-- Add actions here -->
@@ -17,21 +17,4 @@
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>
</web-app>
@@ -1,28 +1,28 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title><s:text name="HelloWorld.message"/></title>
</head>
<body>
<h2><s:property value="message"/></h2>
<h3>Languages</h3>
<ul>
<li>
<s:url id="url" action="HelloWorld">
<s:param name="request_locale">en</s:param>
</s:url>
<s:a href="%{url}">English</s:a>
</li>
<li>
<s:url id="url" action="HelloWorld">
<s:param name="request_locale">es</s:param>
</s:url>
<s:a href="%{url}">Espanol</s:a>
</li>
</ul>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title><s:text name="HelloWorld.message"/></title>
</head>
<body>
<h2><s:property value="message"/></h2>
<h3>Languages</h3>
<ul>
<li>
<s:url id="url" action="HelloWorld">
<s:param name="request_locale">en</s:param>
</s:url>
<s:a href="%{url}">English</s:a>
</li>
<li>
<s:url id="url" action="HelloWorld">
<s:param name="request_locale">es</s:param>
</s:url>
<s:a href="%{url}">Espanol</s:a>
</li>
</ul>
</body>
</html>
@@ -1,15 +1,15 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Sign On</title>
</head>
<body>
<s:form action="Login">
<s:textfield key="username"/>
<s:password key="password" />
<s:submit/>
</s:form>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Sign On</title>
</head>
<body>
<s:form action="Login">
<s:textfield key="username"/>
<s:password key="password" />
<s:submit/>
</s:form>
</body>
</html>
@@ -1,3 +1,3 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:include value="Missing.jsp"/>
@@ -1,11 +1,11 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>Missing Feature</title></head>
<body>
<p>
<s:text name="Missing.message"/>
</p>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head><title>Missing Feature</title></head>
<body>
<p>
<s:text name="Missing.message"/>
</p>
</body>
</html>
@@ -1,3 +1,3 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:include value="Missing.jsp"/>
@@ -1,18 +1,18 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Welcome</title>
<link href="<s:url value="/css/examplecss"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<h3>Commands</h3>
<ul>
<li><a href="<s:url action="Login_input"/>">Sign On</a></li>
<li><a href="<s:url action="Register"/>">Register</a></li>
</ul>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Welcome</title>
<link href="<s:url value="/css/examplecss"/>" rel="stylesheet"
type="text/css"/>
</head>
<body>
<h3>Commands</h3>
<ul>
<li><a href="<s:url action="Login_input"/>">Sign On</a></li>
<li><a href="<s:url action="Register"/>">Register</a></li>
</ul>
</body>
</html>
@@ -24,6 +24,7 @@ package example;
import org.apache.struts2.StrutsTestCase;
import com.opensymphony.xwork2.ActionSupport;
import junit.framework.TestCase;
public class HelloWorldTest extends StrutsTestCase {
+2 -7
View File
@@ -14,10 +14,5 @@ For more about the MailReader applicaton genneraly, visit Struts University.
* http://www.StrutsUniversity.org/
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.
----------------------------------------------------------------------------
+11 -32
View File
@@ -26,12 +26,18 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-mailreader</artifactId>
<packaging>war</packaging>
<name>Struts 2 Mail Reader Webapp</name>
<name>Mail Reader Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/mailreader</url>
</scm>
<dependencies>
@@ -62,39 +68,12 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-mailreader</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
@@ -12,7 +12,7 @@
</action>
<action name="Welcome" class="mailreader2.Welcome">
<result>/WEB-INF/jsp/Welcome.jsp</result>
<result>/Welcome.jsp</result>
<interceptor-ref name="guest"/>
</action>
@@ -21,7 +21,7 @@
</action>
<action name="Login_*" method="{1}" class="mailreader2.Login">
<result name="input">/WEB-INF/jsp/Login.jsp</result>
<result name="input">/Login.jsp</result>
<result name="cancel" type="redirectAction">Welcome</result>
<result type="redirectAction">MainMenu</result>
<result name="expired" type="chain">ChangePassword</result>
@@ -32,7 +32,7 @@
</action>
<action name="Registration_*" method="{1}" class="mailreader2.Registration">
<result name="input">/WEB-INF/jsp/Registration.jsp</result>
<result name="input">/Registration.jsp</result>
<result type="redirectAction">MainMenu</result>
<interceptor-ref name="guest"/>
</action>
@@ -41,7 +41,7 @@
<package name="subscription" namespace="/" extends="mailreader-support">
<global-results>
<result name="input">/WEB-INF/jsp/Subscription.jsp</result>
<result name="input">/Subscription.jsp</result>
<result type="redirectAction">Registration_input</result>
</global-results>
@@ -56,7 +56,7 @@
<package name="wildcard" namespace="/" extends="mailreader-support">
<action name="*" class="mailreader2.MailreaderSupport">
<result>/WEB-INF/jsp/{1}.jsp</result>
<result>/{1}.jsp</result>
</action>
</package>
@@ -1,36 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.freemarker=INFO
log4j.logger.com.opensymphony=INFO
log4j.logger.com.opensymphony.xwork2.ognl=ERROR
log4j.logger.org.apache.struts2=WARN
log4j.logger.org.apache.struts2.components=WARN
log4j.logger.org.apache.struts2.dispatcher=WARN
log4j.logger.org.apache.struts2.convention=INFO
# Spring Stuff
log4j.logger.org.springframework=WARN
@@ -1,9 +1,13 @@
<?xml version='1.0'?>
<database>
<user username="user" fromAddress="John.User@somewhere.com" fullName="John Q. User" password="pass">
<subscription host="mail.yahoo.com" autoConnect="false" password="foo" type="imap" username="jquser">
</subscription>
<subscription host="mail.hotmail.com" autoConnect="false" password="bar" type="pop3" username="user1234">
</subscription>
</user>
<user username="user" fromAddress="John.User@somewhere.com"
fullName="John Q. User" password="pass">
<subscription host="mail.hotmail.com" autoConnect="false"
password="bar" type="pop3" username="user1234">
</subscription>
<subscription host="mail.yahoo.com" autoConnect="false" password="foo"
type="imap" username="jquser">
</subscription>
</user>
</database>
@@ -27,21 +27,4 @@
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>
</web-app>
+9 -5
View File
@@ -26,11 +26,12 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-parent</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<packaging>pom</packaging>
<name>Struts 2 Webapps</name>
<name>Webapps</name>
<modules>
<module>blank</module>
<module>jboss-blank</module>
@@ -40,6 +41,12 @@
<module>rest-showcase</module>
</modules>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps</url>
</scm>
<profiles>
<profile>
<id>hostedqa</id>
@@ -218,7 +225,4 @@
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
+2 -7
View File
@@ -13,10 +13,5 @@ WAR is not ready-to-run. Extract the portlet WAR, and then copy the
contents of apps/portlet/src/main/etc/<your_portal_server>/ into the
WAR's WEB-INF directory.
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.
----------------------------------------------------------------------------
+24 -17
View File
@@ -26,12 +26,18 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet</artifactId>
<packaging>war</packaging>
<name>Struts 2 Portlet Webapp</name>
<name>Portlet Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/portlet</url>
</scm>
<profiles>
<profile>
@@ -103,10 +109,6 @@
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-portlet-tiles-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
@@ -116,8 +118,22 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
@@ -177,12 +193,6 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -207,7 +217,4 @@
</plugin>
</plugins>
</reporting>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
@@ -1,13 +0,0 @@
<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.2//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
<validators>
<field name="firstName">
<field-validator type="requiredstring">
<message>You must enter a first name</message>
</field-validator>
</field>
<field name="lastName">
<field-validator type="requiredstring">
<message>You must enter a last name</message>
</field-validator>
</field>
</validators>
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="tiles" extends="struts-portlet-tiles-default" namespace="/tiles">
<default-action-ref name="index"/>
<action name="index" class="org.apache.struts2.portlet.example.FormExample">
<result type="tiles">formExampleTiles.index</result>
<result name="success" type="tiles">formExampleTiles.index</result>
</action>
<action name="processTilesFreemarkerExample" class="org.apache.struts2.portlet.example.FormExample" method="input">
<result name="success" type="tiles">formExampleTiles.freemarker</result>
</action>
<action name="processTilesFreemarkerExample" class="org.apache.struts2.portlet.example.FormExample" method="execute">
<result name="input" type="tiles">formExampleTiles.freemarker</result>
<result name="success" type="tiles">formExampleTiles.freemarkerResult</result>
</action>
</package>
</struts>
@@ -8,5 +8,4 @@
<include file="struts-edit.xml"/>
<include file="struts-help.xml"/>
<include file="struts-eventing.xml"/>
<include file="struts-tiles.xml"/>
</struts>
@@ -6,7 +6,6 @@
<validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
<validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
<validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
<validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
<validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
<validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
<validator name="expression" class="com.opensymphony.xwork2.validator.validators.ExpressionValidator"/>
@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
/*
* 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 tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="formExampleTiles.index" template="/WEB-INF/tiles/layout.jsp">
<put-attribute name="title" value="Portlet Tiles FormExample"/>
<put-attribute name="header" value="/WEB-INF/tiles/header.jsp"/>
<put-attribute name="body" value="/WEB-INF/tiles/index.jsp"/>
<put-attribute name="footer" value="/WEB-INF/tiles/footer.jsp"/>
</definition>
<definition name="formExampleTiles.freemarker" extends="formExampleTiles.index">
<put-attribute name="title" value="Portlet Tiles/Freemarker FormExample"/>
<put-attribute name="body" value="/WEB-INF/tiles/formExampleInputValidation.jsp"/>
</definition>
<definition name="formExampleTiles.freemarkerResult" extends="formExampleTiles.freemarker">
<put-attribute name="body" value="/WEB-INF/tiles/formExample.jsp"/>
</definition>
</tiles-definitions>
@@ -12,7 +12,6 @@ Here you'll find examples of what is possible with the Struts Portlet integratio
<li><a href="<s:url action="fileUpload" method="input"/>">File upload</li>
<li><a href="<s:url action="freeMarkerExample"/>">FreeMarker</a></li>
<li><a href="<s:url action="velocityHelloWorld"/>">Velocity</a></li>
<li><a href="<s:url action="index" namespace="/tiles"/>">Form Example Validation with Tiles</a></li>
<li><a href="<s:url action="index" portletMode="edit"/>">Go to edit mode and see what's there</a></li>
<li><a href="<s:url action="index" portletMode="help"/>">Go to help mode and see what's there</a></li>
</ul>
@@ -1,16 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="StrutsPortlet">
<context-param>
<param-name>org.apache.tiles.factory.TilesContainerFactory</param-name>
<param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
</context-param>
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<!-- Uncomment/comment this if you need/don't need Spring support -->
<context-param>
<param-name>contextConfigLocation</param-name>
@@ -22,10 +12,4 @@
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Tiles Plugin -->
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
</web-app>
@@ -1,5 +0,0 @@
<hr/>
<@s.url id="home" action="index" namespace="/view" />
<div>
<p>Powered by Struts2 Portlet/Tiles Plugin | <@s.a href="${home}">Back to front page</@s.a></p>
</div>
@@ -1,6 +0,0 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<hr/>
<s:url id="home" action="index" namespace="/view" />
<div>
<p>Powered by Struts2 Portlet/Tiles Plugin | <s:a href="%{home}">Back to front page</s:a></p>
</div>
@@ -1,5 +0,0 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<H2>Hello <s:property value="firstName"/> <s:property value="lastName"/></H2>
<p/>
@@ -1,8 +0,0 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<link rel="stylesheet" type="text/css" href="<s:url value="/styles/styles.css"/>">
<H2>Input your name</H2>
<s:form action="processTilesFreemarkerExample" namespace="/tiles" method="POST" >
<s:textfield label="First name" name="firstName" value="%{firstName}"/>
<s:textfield label="Last name" name="lastName" value="%{lastName}"/>
<s:submit value="Submit the form"/>
</s:form>
@@ -1,2 +0,0 @@
<h1>Struts2 Portlet Tiles App Example</h1>
<hr/>
@@ -1,13 +0,0 @@
<%@taglib prefix="s" uri="/struts-tags" %>
<div>
<p>This example illustrates the Struts/Portlet/Tiles Plugin.</p>
<h4>Features</h4>
<ul>
<li>
<s:url id="freemarker" namespace="/tiles" action="processTilesFreemarkerExample" method="input" />
<s:a href="%{freemarker}">View FreeMarker Example</s:a>
</li>
</ul>
</div>
@@ -1,13 +0,0 @@
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<tiles:importAttribute name="title" scope="request"/>
<tiles:insertAttribute name="header"/>
<h2><tiles:insertAttribute name="title"/></h2>
<p id="body">
<tiles:insertAttribute name="body"/>
</p>
<p>Notice that this is a layout made in JSP</p>
<tiles:insertAttribute name="footer"/>
-15
View File
@@ -1,15 +0,0 @@
README.txt - Rest Showcase Webapp
Rest Showcase is a simple example of REST app build with the REST plugin.
For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.
+58 -60
View File
@@ -22,31 +22,30 @@
*/
-->
<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>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.17</version>
<name>Struts 2 Rest Showcase Webapp</name>
<description>Struts 2 Rest Showcase Example</description>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-showcase</artifactId>
<packaging>war</packaging>
<version>2.3.4</version>
<name>Struts 2 Rest Showcase Example</name>
<description>Struts 2 Rest Showcase Example</description>
<dependencies>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-rest-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@@ -60,12 +59,13 @@
<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>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jwebunit</groupId>
@@ -83,50 +83,41 @@
</dependencies>
<build>
<finalName>struts2-rest-showcase</finalName>
<plugins>
<plugin>
<finalName>struts2-rest-showcase</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-rest-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
<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>
@@ -136,9 +127,16 @@
</excludes>
</configuration>
</plugin>
</plugins>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!--
<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>
@@ -1,4 +1,4 @@
package org.demo.rest.example;
package org.apache.struts2.rest.example;
public class Order {
String id;
@@ -1,11 +1,16 @@
package org.demo.rest.example;
package org.apache.struts2.rest.example;
import java.util.Collection;
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;
@@ -1,4 +1,4 @@
package org.demo.rest.example;
package org.apache.struts2.rest.example;
import java.util.*;
@@ -1,29 +0,0 @@
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=ERROR
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
# Struts2 Stuff
log4j.logger.org.apache.struts2=INFO
@@ -1,38 +1,23 @@
<!DOCTYPE html>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8">
<title>Order ${id}</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
<title>Order ${id}</title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Delete Order ${id}</h1>
</div>
<form action="../${id}?_method=DELETE" method="post">
<p>
Are you sure you want to delete order ${id}?
</p>
<div class="btn-group">
<input type="submit" value="Delete" class="btn btn-danger" />
<input type="button" value="Cancel" class="btn btn-success" onclick="window.location.href = '../../orders'" />
</div>
</form>
<br />
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<form action="../${id}?_method=DELETE" method="post">
<p>
Are you sure you want to delete order ${id}?
</p>
<div>
<input type="submit" value="Delete" />
<input type="button" value="Cancel" onclick="window.location.href = '../../orders'" />
</div>
</form>
<br />
<a href="../../orders">Back to Orders</a>
</body>
</html>
@@ -1,55 +1,27 @@
<!DOCTYPE html>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<html lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8">
<title>Order <s:property value="id" /></title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
<title>Order <s:property value="id" /></title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Order <s:property value="id" /></h1>
</div>
<s:fielderror cssClass="alert alert-error"/>
<s:form method="post" action="%{#request.contextPath}/orders/%{id}" cssClass="form-horizontal" theme="simple">
<s:hidden name="_method" value="put" />
<div class="control-group">
<label class="control-label" for="id">ID</label>
<div class="controls">
<s:textfield id="id" name="id" disabled="true"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="clientName">Client</label>
<div class="controls">
<s:textfield id="clientName" name="clientName"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="amount">Amount</label>
<div class="controls">
<s:textfield id="amount" name="amount" />
</div>
</div>
<div class="form-actions">
<s:submit cssClass="btn btn-primary"/>
</div>
<table>
</s:form>
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<s:form method="post" action="%{#request.contextPath}/orders/%{id}">
<s:hidden name="_method" value="put" />
<table>
<s:textfield name="id" label="ID" disabled="true"/>
<s:textfield name="clientName" label="Client"/>
<s:textfield name="amount" label="Amount" />
<tr>
<td colspan="2">
<s:submit />
</td>
</table>
</s:form>
<a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
</body>
</html>
@@ -1,47 +1,25 @@
<!DOCTYPE html>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<html lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8">
<title>New Order</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
<title>New Order</title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>New Order</h1>
</div>
<s:fielderror cssClass="alert alert-error"/>
<s:form method="post" action="%{#request.contextPath}/orders" cssClass="form-horizontal" theme="simple">
<div class="control-group">
<label class="control-label" for="clientName">Client</label>
<div class="controls">
<s:textfield id="clientName" name="clientName"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="amount">Amount</label>
<div class="controls">
<s:textfield id="amount" name="amount" />
</div>
</div>
<div class="form-actions">
<s:submit cssClass="btn btn-primary"/>
</div>
</s:form>
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<s:form method="post" action="%{#request.contextPath}/orders">
<table>
<s:textfield name="clientName" label="Client"/>
<s:textfield name="amount" label="Amount" />
<tr>
<td colspan="2">
<s:submit />
</td>
</table>
</s:form>
<a href="<%=request.getContextPath() %>/orders">Back to Orders</a>
</body>
</html>
@@ -1,48 +1,34 @@
<!DOCTYPE html>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<html lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8">
<title>Orders</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
<title>Orders</title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Orders</h1>
</div>
<s:actionmessage cssClass="alert alert-error"/>
<table class="table table-striped">
<tr>
<th>ID</th>
<th>Client</th>
<th>Amount</th>
<th>Actions</th>
</tr>
<s:iterator value="model">
<tr>
<td>${id}</td>
<td><s:property value="clientName"/></td>
<td><s:property value="amount"/></td>
<td>
<div class="btn-group">
<a href="orders/${id}" class="btn"><i class="icon icon-eye-open"></i> View</a>
<a href="orders/${id}/edit" class="btn"><i class="icon icon-edit"></i> Edit</a>
<a href="orders/${id}/deleteConfirm" class="btn btn-danger"><i class="icon icon-trash"></i> Delete</a>
</div>
</td>
</tr>
</s:iterator>
</table>
<a href="orders/new" class="btn btn-primary"><i class="icon icon-file"></i> Create a new order</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<s:actionmessage />
<table>
<tr>
<th>ID</th>
<th>Client</th>
<th>Amount</th>
<th>Actions</th>
</tr>
<s:iterator value="model">
<tr>
<td>${id}</td>
<td><s:property value="clientName"/></td>
<td><s:property value="amount"/></td>
<td><a href="orders/${id}">View</a> |
<a href="orders/${id}/edit">Edit</a> |
<a href="orders/${id}/deleteConfirm">Delete</a></td>
</tr>
</s:iterator>
</table>
<a href="orders/new">Create a new order</a>
</body>
</html>
@@ -1,40 +1,29 @@
<!DOCTYPE html>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags" %>
<html lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="utf-8">
<title>Order ${id}</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/bootstrap-responsive.css" rel="stylesheet">
<title>Order ${id}</title>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="page-header">
<h1>Order ${id}</h1>
</div>
<table class="table table-striped">
<tr>
<td class="span3">ID</td>
<td class="span9"><s:property value="id"/></td>
</tr>
<tr>
<td class="span3">Client</td>
<td class="span9"><s:property value="clientName"/></td>
</tr>
<tr>
<td class="span3">Amount</td>
<td class="span9"><s:property value="amount"/></td>
</tr>
</table>
<a href="${pageContext.request.contextPath}/orders" class="btn btn-info">
<i class="icon icon-arrow-left"></i> Back to Orders
</a>
</div><!--/row-->
</div><!--/span-->
</div><!--/row-->
<table>
<tr>
<th>ID</th>
<td>${id}</td>
</tr>
<tr>
<th>Client</th>
<td><s:property value="clientName"/></td>
</tr>
<tr>
<th>Amount</th>
<td><s:property value="amount"/></td>
</tr>
</table>
<a href="../orders">Back to Orders</a>
</body>
</html>
@@ -26,21 +26,4 @@
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>
</web-app>
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

+1 -7
View File
@@ -7,10 +7,4 @@ For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.
----------------------------------------------------------------------------
+78 -28
View File
@@ -26,12 +26,19 @@
<parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-apps</artifactId>
<version>2.3.17</version>
<version>2.3.4</version>
</parent>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-showcase</artifactId>
<packaging>war</packaging>
<name>Struts 2 Showcase Webapp</name>
<name>Showcase Webapp</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</developerConnection>
<url>http://svn.apache.org/viewcvs.cgi/struts/struts2/tags/STRUTS_2_3_4/apps/showcase</url>
</scm>
<profiles>
<profile>
@@ -49,41 +56,49 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-struts1-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dojo-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-jsf-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-sitemesh-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-dwr-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -95,11 +110,13 @@
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-convention-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -117,15 +134,32 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<exclusions>
<exclusion>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>uk.ltd.getahead</groupId>
<artifactId>dwr</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
@@ -133,7 +167,7 @@
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
@@ -183,37 +217,47 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.1</version>
<configuration>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>file:${basedir}/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
<webAppConfig>
<contextPath>/struts2-showcase</contextPath>
<descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
</webAppConfig>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<version>1.2.9</version>
</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>
@@ -239,7 +283,13 @@
</resources>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!--
<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>
@@ -20,84 +20,87 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import com.opensymphony.xwork2.ActionSupport;
/**
* <code>DateAction</code>
*
*/
public class DateAction extends ActionSupport {
private static DateFormat DF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
private static DateFormat DF = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
private Date now;
private Date past;
private Date future;
private Date after;
private Date before;
private Date now;
private Date past;
private Date future;
private Date after;
private Date before;
public String getDate() {
return DF.format(new Date());
}
public String getDate() {
return DF.format(new Date());
}
/**
* @return Returns the future.
*/
public Date getFuture() {
return future;
}
/**
* @return Returns the future.
*/
public Date getFuture() {
return future;
}
/**
* @return Returns the now.
*/
public Date getNow() {
return now;
}
/**
* @return Returns the now.
*/
public Date getNow() {
return now;
}
/**
* @return Returns the past.
*/
public Date getPast() {
return past;
}
/**
* @return Returns the past.
*/
public Date getPast() {
return past;
}
/**
* @return Returns the before date.
*/
public Date getBefore() {
return before;
}
/**
*
* @return Returns the before date.
*/
public Date getBefore() {
return before;
}
/**
* @return Returns the after date.
*/
public Date getAfter() {
return after;
}
/**
*
* @return Returns the after date.
*/
public Date getAfter() {
return after;
}
/**
*/
public String browse() throws Exception {
Calendar cal = GregorianCalendar.getInstance();
now = cal.getTime();
cal.roll(Calendar.DATE, -1);
cal.roll(Calendar.HOUR, -3);
past = cal.getTime();
cal.roll(Calendar.DATE, 2);
future = cal.getTime();
/**
*/
public String browse() throws Exception {
Calendar cal = GregorianCalendar.getInstance();
now = cal.getTime();
cal.roll(Calendar.DATE, -1);
cal.roll(Calendar.HOUR, -3);
past = cal.getTime();
cal.roll(Calendar.DATE, 2);
future = cal.getTime();
cal.roll(Calendar.YEAR, -1);
before = cal.getTime();
cal.roll(Calendar.YEAR, -1);
before = cal.getTime();
cal.roll(Calendar.YEAR, 2);
after = cal.getTime();
return SUCCESS;
}
cal.roll(Calendar.YEAR, 2);
after = cal.getTime();
return SUCCESS;
}
}
@@ -20,35 +20,35 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
import com.opensymphony.xwork2.ActionSupport;
//START SNIPPET: treeExampleDynamicJavaSelected
public class DynamicTreeSelectAction extends ActionSupport {
private long nodeId;
private Category currentCategory;
private long nodeId;
private Category currentCategory;
public void setNodeId(long nodeId) {
this.nodeId = nodeId;
}
public long getNodeId() {
return nodeId;
}
public void setNodeId(long nodeId) {
this.nodeId = nodeId;
}
public long getNodeId() {
return nodeId;
}
public String execute() throws Exception {
currentCategory = Category.getById(nodeId);
return SUCCESS;
}
public String execute() throws Exception {
currentCategory = Category.getById(nodeId);
return SUCCESS;
}
public String getNodeName() {
return currentCategory != null ? currentCategory.getName() : "Node not found";
}
public String getNodeName() {
return currentCategory != null ? currentCategory.getName() : "Node not found";
}
}
//START SNIPPET: treeExampleDynamicJavaSelected
@@ -20,261 +20,267 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import com.opensymphony.xwork2.ActionSupport;
/**
*/
public class LotsOfOptiontransferselectAction extends ActionSupport {
private List _favouriteCartoonCharactersKeys;
private List _notFavouriteCartoonCharactersKeys;
private List _favouriteCartoonCharactersKeys;
private List _notFavouriteCartoonCharactersKeys;
private List _favouriteCarsKeys;
private List _notFavouriteCarsKeys;
private List _favouriteCarsKeys;
private List _notFavouriteCarsKeys;
private List _favouriteMotorcyclesKeys;
private List _notFavouriteMotorcyclesKeys;
private List _favouriteMotorcyclesKeys;
private List _notFavouriteMotorcyclesKeys;
private List _favouriteCountriesKeys;
private List _notFavouriteCountriesKeys;
private List _favouriteCountriesKeys;
private List _notFavouriteCountriesKeys;
private List _favouriteSportsKeys;
private List _nonFavouriteSportsKeys;
private List _favouriteSportsKeys;
private List _nonFavouriteSportsKeys;
private List _favouriteCities;
private List _favouriteCities;
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
public Map getDefaultNotFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("donaldDuck", "Donald Duck");
m.put("atomicAnt", "Atomic Ant");
m.put("pinkPainter", "Pink Painter");
return m;
}
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
public List getFavouriteCartoonCharacters() {
return _favouriteCartoonCharactersKeys;
}
public Map getDefaultNotFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("donaldDuck", "Donald Duck");
m.put("atomicAnt", "Atomic Ant");
m.put("pinkPainter", "Pink Painter");
return m;
}
public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) {
_favouriteCartoonCharactersKeys = favouriteCartoonCharacters;
}
public List getFavouriteCartoonCharacters() {
return _favouriteCartoonCharactersKeys;
}
public List getNotFavouriteCartoonCharacters() {
return _notFavouriteCartoonCharactersKeys;
}
public void setFavouriteCartoonCharacters(List favouriteCartoonCharacters) {
_favouriteCartoonCharactersKeys = favouriteCartoonCharacters;
}
public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) {
_notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters;
}
public List getNotFavouriteCartoonCharacters() {
return _notFavouriteCartoonCharactersKeys;
}
public void setNotFavouriteCartoonCharacters(List notFavouriteCartoonCharacters) {
_notFavouriteCartoonCharactersKeys = notFavouriteCartoonCharacters;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
public Map getDefaultNotFavouriteCars() {
Map m = new LinkedHashMap();
m.put("ford", "Ford");
m.put("landRover", "Land Rover");
m.put("mercedes", "Mercedes");
return m;
}
public List getFavouriteCars() {
return _favouriteCarsKeys;
}
public void setFavouriteCars(List favouriteCars) {
_favouriteCarsKeys = favouriteCars;
}
public List getNotFavouriteCars() {
return _notFavouriteCarsKeys;
}
public void setNotFavouriteCars(List notFavouriteCars) {
_notFavouriteCarsKeys = notFavouriteCars;
}
// Motorcycles
public Map getDefaultFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("honda", "Honda");
m.put("yamaha", "Yamaha");
m.put("Aprillia", "Aprillia");
return m;
}
public Map getDefaultNotFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("cagiva", "Cagiva");
m.put("harleyDavidson", "Harley Davidson");
m.put("suzuki", "Suzuki");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
public List getFavouriteMotorcycles() {
return _favouriteMotorcyclesKeys;
}
public Map getDefaultNotFavouriteCars() {
Map m = new LinkedHashMap();
m.put("ford", "Ford");
m.put("landRover", "Land Rover");
m.put("mercedes", "Mercedes");
return m;
}
public void setFavouriteMotorcycles(List favouriteMotorcycles) {
_favouriteMotorcyclesKeys = favouriteMotorcycles;
}
public List getFavouriteCars() {
return _favouriteCarsKeys;
}
public List getNotFavouriteMotorcycles() {
return _notFavouriteMotorcyclesKeys;
}
public void setFavouriteCars(List favouriteCars) {
_favouriteCarsKeys = favouriteCars;
}
public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) {
_notFavouriteMotorcyclesKeys = notFavouriteMotorcycles;
}
public List getNotFavouriteCars() {
return _notFavouriteCarsKeys;
}
public void setNotFavouriteCars(List notFavouriteCars) {
_notFavouriteCarsKeys = notFavouriteCars;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public Map getDefaultNotFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("germany", "Germany");
m.put("china", "China");
m.put("russia", "Russia");
return m;
}
// Motorcycles
public Map getDefaultFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("honda", "Honda");
m.put("yamaha", "Yamaha");
m.put("Aprillia", "Aprillia");
return m;
}
public List getFavouriteCountries() {
return _favouriteCountriesKeys;
}
public Map getDefaultNotFavouriteMotorcycles() {
Map m = new LinkedHashMap();
m.put("cagiva", "Cagiva");
m.put("harleyDavidson", "Harley Davidson");
m.put("suzuki", "Suzuki");
return m;
}
public void setFavouriteCountries(List favouriteCountries) {
_favouriteCountriesKeys = favouriteCountries;
}
public List getFavouriteMotorcycles() {
return _favouriteMotorcyclesKeys;
}
public List getNotFavouriteCountries() {
return _notFavouriteCountriesKeys;
}
public void setFavouriteMotorcycles(List favouriteMotorcycles) {
_favouriteMotorcyclesKeys = favouriteMotorcycles;
}
public void setNotFavouriteCountries(List notFavouriteCountries) {
_notFavouriteCountriesKeys = notFavouriteCountries;
}
public List getNotFavouriteMotorcycles() {
return _notFavouriteMotorcyclesKeys;
}
// Sports
public Map getDefaultNonFavoriteSports() {
Map m = new LinkedHashMap();
m.put("basketball", "Basketball");
m.put("football", "Football");
m.put("baseball", "Baseball");
return m;
}
public Map getDefaultFavoriteSports() {
return new LinkedHashMap();
}
public List getFavouriteSports() {
return _favouriteSportsKeys;
}
public void setFavouriteSports(List favouriteSportsKeys) {
this._favouriteSportsKeys = favouriteSportsKeys;
}
public List getNonFavouriteSports() {
return _nonFavouriteSportsKeys;
}
public void setNonFavouriteSports(List notFavouriteSportsKeys) {
this._nonFavouriteSportsKeys = notFavouriteSportsKeys;
}
public void setNotFavouriteMotorcycles(List notFavouriteMotorcycles) {
_notFavouriteMotorcyclesKeys = notFavouriteMotorcycles;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public Map getDefaultNotFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("germany", "Germany");
m.put("china", "China");
m.put("russia", "Russia");
return m;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getFavouriteCountries() {
return _favouriteCountriesKeys;
}
public void setFavouriteCountries(List favouriteCountries) {
_favouriteCountriesKeys = favouriteCountries;
}
public List getNotFavouriteCountries() {
return _notFavouriteCountriesKeys;
}
public void setNotFavouriteCountries(List notFavouriteCountries) {
_notFavouriteCountriesKeys = notFavouriteCountries;
}
// Sports
public Map getDefaultNonFavoriteSports() {
Map m = new LinkedHashMap();
m.put("basketball", "Basketball");
m.put("football", "Football");
m.put("baseball", "Baseball");
return m;
}
public Map getDefaultFavoriteSports() {
return new LinkedHashMap();
}
public List getFavouriteSports() {
return _favouriteSportsKeys;
}
public void setFavouriteSports(List favouriteSportsKeys) {
this._favouriteSportsKeys = favouriteSportsKeys;
}
public List getNonFavouriteSports() {
return _nonFavouriteSportsKeys;
}
public void setNonFavouriteSports(List notFavouriteSportsKeys) {
this._nonFavouriteSportsKeys = notFavouriteSportsKeys;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
public List getFavouriteCities() {
return _favouriteCities;
}
public void setFavouriteCities(List favouriteCities) {
this._favouriteCities = favouriteCities;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
// actions
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
public String input() throws Exception {
return SUCCESS;
}
public List getFavouriteCities() {
return _favouriteCities;
}
public String submit() throws Exception {
return SUCCESS;
}
public void setFavouriteCities(List favouriteCities) {
this._favouriteCities = favouriteCities;
}
// actions
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -27,52 +27,52 @@ import com.opensymphony.xwork2.ActionSupport;
*/
public class LotsOfRichtexteditorAction extends ActionSupport {
public String description1;
public String description2 = "This is Description 2";
public String description3;
public String description4 = "This is Description 4";
public String description1;
public String description2 = "This is Description 2";
public String description3;
public String description4 = "This is Description 4";
public String getDescription1() {
return this.description1;
}
public void setDescription1(String description1) {
this.description1 = description1;
}
public String getDescription1() {
return this.description1;
}
public void setDescription1(String description1) {
this.description1 = description1;
}
public String getDescription2() {
return this.description2;
}
public void setDescription2(String description2) {
this.description2 = description2;
}
public String getDescription2() {
return this.description2;
}
public void setDescription2(String description2) {
this.description2 = description2;
}
public String getDescription3() {
return this.description3;
}
public void setDescription3(String description3) {
this.description3 = description3;
}
public String getDescription3() {
return this.description3;
}
public void setDescription3(String description3) {
this.description3 = description3;
}
public String getDescription4() {
return this.description4;
}
public void setDescription4(String description4) {
this.description4 = description4;
}
public String input() throws Exception {
return SUCCESS;
}
public String getDescription4() {
return this.description4;
}
public void setDescription4(String description4) {
this.description4 = description4;
}
public String submit() throws Exception {
return SUCCESS;
}
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -22,115 +22,114 @@ package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.LinkedHashMap;
import java.util.ArrayList;
/**
*/
public class MoreSelectsAction extends ActionSupport {
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List favouriteNumbers;
private List _prioritisedFavouriteCartoonCharacters;
private List _prioritisedFavouriteCars;
private List _prioritisedFavouriteCountries;
private List favouriteNumbers;
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
// Cartoon Characters
public Map getDefaultFavouriteCartoonCharacters() {
Map m = new LinkedHashMap();
m.put("heMan", "He-Man");
m.put("popeye", "Popeye");
m.put("mockeyMouse", "Mickey Mouse");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
// Cars
public Map getDefaultFavouriteCars() {
Map m = new LinkedHashMap();
m.put("alfaRomeo", "Alfa Romeo");
m.put("Toyota", "Toyota");
m.put("Mitsubitshi", "Mitsubitshi");
return m;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public List getDefaultFavouriteNumbers() {
List list = new ArrayList();
list.add("Three");
list.add("Seven");
return list;
}
// Countries
public Map getDefaultFavouriteCountries() {
Map m = new LinkedHashMap();
m.put("england", "England");
m.put("america", "America");
m.put("brazil", "Brazil");
return m;
}
public List getDefaultFavouriteNumbers() {
List list = new ArrayList();
list.add("Three");
list.add("Seven");
return list;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCartoonCharacters() {
return _prioritisedFavouriteCartoonCharacters;
}
public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
_prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCars() {
return _prioritisedFavouriteCars;
}
public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
_prioritisedFavouriteCars = prioritisedFavouriteCars;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public List getPrioritisedFavouriteCountries() {
return _prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
_prioritisedFavouriteCountries = prioritisedFavouriteCountries;
}
public List getFavouriteNumbers() {
return favouriteNumbers;
}
public List getFavouriteNumbers() {
return favouriteNumbers;
}
public void setFavouriteNumbers(List favouriteNumbers) {
this.favouriteNumbers = favouriteNumbers;
}
public void setFavouriteNumbers(List favouriteNumbers) {
this.favouriteNumbers = favouriteNumbers;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public Map getAvailableCities() {
Map map = new LinkedHashMap();
map.put("boston", "Boston");
map.put("new york", "New York");
map.put("london", "London");
map.put("rome", "Rome");
return map;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
public List getDefaultFavouriteCities() {
List list = new ArrayList();
list.add("boston");
list.add("rome");
return list;
}
// actions
// actions
public String input() throws Exception {
return SUCCESS;
}
public String input() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
public String submit() throws Exception {
return SUCCESS;
}
}
@@ -20,21 +20,22 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
import com.opensymphony.xwork2.ActionSupport;
public class ShowAjaxDynamicTreeAction extends ActionSupport {
private int nodeId = 1;
private int nodeId = 1;
public Category getCategory() {
return Category.getById(nodeId);
}
public Category getCategory() {
return Category.getById(nodeId);
}
public int getNodeId() {
return nodeId;
}
public int getNodeId() {
return nodeId;
}
public void setNodeId(int nodeId) {
this.nodeId = nodeId;
}
public void setNodeId(int nodeId) {
this.nodeId = nodeId;
}
}
@@ -20,16 +20,17 @@
*/
package org.apache.struts2.showcase;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.showcase.ajax.tree.Category;
import com.opensymphony.xwork2.ActionSupport;
// START SNIPPET: treeExampleDynamicJavaShow
public class ShowDynamicTreeAction extends ActionSupport {
public Category getTreeRootNode() {
return Category.getById(1);
}
public Category getTreeRootNode() {
return Category.getById(1);
}
}
// END SNIPPET: treeExampleDynamicJavaShow
@@ -26,324 +26,312 @@ import com.opensymphony.xwork2.util.ValueStack;
import org.apache.struts2.ServletActionContext;
import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*/
public class UITagExample extends ActionSupport implements Validateable {
private static final long serialVersionUID = -94044809860988047L;
String name;
Date birthday;
Date wakeup;
String bio;
String favouriteColor;
List friends;
String bestFriend;
boolean legalAge;
String state;
String region;
File picture;
String pictureContentType;
String pictureFileName;
String favouriteLanguage;
String favouriteVehicalType = "MotorcycleKey";
String favouriteVehicalSpecific = "YamahaKey";
List leftSideCartoonCharacters;
List rightSideCartoonCharacters;
List favouriteLanguages = new ArrayList();
List vehicalTypeList = new ArrayList();
Map vehicalSpecificMap = new HashMap();
String thoughts;
public UITagExample() {
favouriteLanguages.add(new Language("EnglishKey", "English Language", "color: blue; font-style: italic;"));
favouriteLanguages.add(new Language("FrenchKey", "French Language", "color: grey;"));
favouriteLanguages.add(new Language("SpanishKey", "Spanish Language", "color: red; font-wight: bold;"));
VehicalType car = new VehicalType("CarKey", "Car");
VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle");
vehicalTypeList.add(car);
vehicalTypeList.add(motorcycle);
List cars = new ArrayList();
cars.add(new VehicalSpecific("MercedesKey", "Mercedes"));
cars.add(new VehicalSpecific("HondaKey", "Honda"));
cars.add(new VehicalSpecific("FordKey", "Ford"));
List motorcycles = new ArrayList();
motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki"));
motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha"));
vehicalSpecificMap.put(car, cars);
vehicalSpecificMap.put(motorcycle, motorcycles);
}
public List getLeftSideCartoonCharacters() {
return leftSideCartoonCharacters;
}
public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) {
this.leftSideCartoonCharacters = leftSideCartoonCharacters;
}
public List getRightSideCartoonCharacters() {
return rightSideCartoonCharacters;
}
public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) {
this.rightSideCartoonCharacters = rightSideCartoonCharacters;
}
public String getFavouriteVehicalType() {
return favouriteVehicalType;
}
public void setFavouriteVehicalType(String favouriteVehicalType) {
this.favouriteVehicalType = favouriteVehicalType;
}
public String getFavouriteVehicalSpecific() {
return favouriteVehicalSpecific;
}
public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) {
this.favouriteVehicalSpecific = favouriteVehicalSpecific;
}
public List getVehicalTypeList() {
return vehicalTypeList;
}
public List getVehicalSpecificList() {
ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest());
Object vehicalType = stack.findValue("top");
if (vehicalType != null && vehicalType instanceof VehicalType) {
List l = (List) vehicalSpecificMap.get(vehicalType);
return l;
}
return Collections.EMPTY_LIST;
}
public List getFavouriteLanguages() {
return favouriteLanguages;
}
public String execute() throws Exception {
return SUCCESS;
}
public String getName() {
return name;
}
private static final long serialVersionUID = -94044809860988047L;
String name;
Date birthday;
Date wakeup;
String bio;
String favouriteColor;
List friends;
String bestFriend;
boolean legalAge;
String state;
String region;
File picture;
String pictureContentType;
String pictureFileName;
String favouriteLanguage;
String favouriteVehicalType = "MotorcycleKey";
String favouriteVehicalSpecific = "YamahaKey";
List leftSideCartoonCharacters;
List rightSideCartoonCharacters;
List favouriteLanguages = new ArrayList();
List vehicalTypeList = new ArrayList();
Map vehicalSpecificMap = new HashMap();
String thoughts;
public UITagExample() {
favouriteLanguages.add(new Language("EnglishKey", "English Language"));
favouriteLanguages.add(new Language("FrenchKey", "French Language"));
favouriteLanguages.add(new Language("SpanishKey", "Spanish Language"));
VehicalType car = new VehicalType("CarKey", "Car");
VehicalType motorcycle = new VehicalType("MotorcycleKey", "Motorcycle");
vehicalTypeList.add(car);
vehicalTypeList.add(motorcycle);
List cars = new ArrayList();
cars.add(new VehicalSpecific("MercedesKey", "Mercedes"));
cars.add(new VehicalSpecific("HondaKey", "Honda"));
cars.add(new VehicalSpecific("FordKey", "Ford"));
List motorcycles = new ArrayList();
motorcycles.add(new VehicalSpecific("SuzukiKey", "Suzuki"));
motorcycles.add(new VehicalSpecific("YamahaKey", "Yamaha"));
vehicalSpecificMap.put(car, cars);
vehicalSpecificMap.put(motorcycle, motorcycles);
}
public List getLeftSideCartoonCharacters() {
return leftSideCartoonCharacters;
}
public void setLeftSideCartoonCharacters(List leftSideCartoonCharacters) {
this.leftSideCartoonCharacters = leftSideCartoonCharacters;
}
public List getRightSideCartoonCharacters() {
return rightSideCartoonCharacters;
}
public void setRightSideCartoonCharacters(List rightSideCartoonCharacters) {
this.rightSideCartoonCharacters = rightSideCartoonCharacters;
}
public String getFavouriteVehicalType() {
return favouriteVehicalType;
}
public void setFavouriteVehicalType(String favouriteVehicalType) {
this.favouriteVehicalType = favouriteVehicalType;
}
public String getFavouriteVehicalSpecific() {
return favouriteVehicalSpecific;
}
public void setFavouriteVehicalSpecific(String favouriteVehicalSpecific) {
this.favouriteVehicalSpecific = favouriteVehicalSpecific;
}
public List getVehicalTypeList() {
return vehicalTypeList;
}
public List getVehicalSpecificList() {
ValueStack stack = ServletActionContext.getValueStack(ServletActionContext.getRequest());
Object vehicalType = stack.findValue("top");
if (vehicalType != null && vehicalType instanceof VehicalType) {
List l = (List) vehicalSpecificMap.get(vehicalType);
return l;
}
return Collections.EMPTY_LIST;
}
public List getFavouriteLanguages() {
return favouriteLanguages;
}
public String execute() throws Exception {
return SUCCESS;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getBirthday() {
return birthday;
}
public void setName(String name) {
this.name = name;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getBio() {
return bio;
}
public Date getBirthday() {
return birthday;
}
public void setBio(String bio) {
this.bio = bio;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getFavouriteColor() {
return favouriteColor;
}
public String getBio() {
return bio;
}
public void setFavouriteColor(String favoriteColor) {
this.favouriteColor = favoriteColor;
}
public void setBio(String bio) {
this.bio = bio;
}
public List getFriends() {
return friends;
}
public String getFavouriteColor() {
return favouriteColor;
}
public void setFriends(List friends) {
this.friends = friends;
}
public void setFavouriteColor(String favoriteColor) {
this.favouriteColor = favoriteColor;
}
public String getBestFriend() {
return bestFriend;
}
public List getFriends() {
return friends;
}
public void setBestFriend(String bestFriend) {
this.bestFriend = bestFriend;
}
public boolean isLegalAge() {
return legalAge;
}
public void setFriends(List friends) {
this.friends = friends;
}
public String getBestFriend() {
return bestFriend;
}
public void setBestFriend(String bestFriend) {
this.bestFriend = bestFriend;
}
public boolean isLegalAge() {
return legalAge;
}
public void setLegalAge(boolean legalAge) {
this.legalAge = legalAge;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public void setPicture(File picture) {
this.picture = picture;
}
public File getPicture() {
return this.picture;
}
public void setPictureContentType(String pictureContentType) {
this.pictureContentType = pictureContentType;
}
public void setPictureFileName(String pictureFileName) {
this.pictureFileName = pictureFileName;
}
public void setFavouriteLanguage(String favouriteLanguage) {
this.favouriteLanguage = favouriteLanguage;
}
public String getFavouriteLanguage() {
return favouriteLanguage;
}
public void setThoughts(String thoughts) {
this.thoughts = thoughts;
}
public String getThoughts() {
return this.thoughts;
}
public Date getWakeup() {
return wakeup;
}
public void setWakeup(Date wakeup) {
this.wakeup = wakeup;
}
public String doSubmit() {
return SUCCESS;
}
// === inner class
public static class Language {
String description;
String key;
String style;
public Language(String key, String description, String style) {
this.key = key;
this.description = description;
this.style = style;
}
public String getKey() {
return key;
}
public String getDescription() {
return description;
}
public String getStyle() {
return style;
}
}
public static class VehicalType {
String key;
String description;
public VehicalType(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() {
return this.key;
}
public String getDescription() {
return this.description;
}
public boolean equals(Object obj) {
if (!(obj instanceof VehicalType)) {
return false;
} else {
return key.equals(((VehicalType) obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
public static class VehicalSpecific {
String key;
String description;
public VehicalSpecific(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() {
return this.key;
}
public String getDescription() {
return this.description;
}
public boolean equals(Object obj) {
if (!(obj instanceof VehicalSpecific)) {
return false;
} else {
return key.equals(((VehicalSpecific) obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
public void setLegalAge(boolean legalAge) {
this.legalAge = legalAge;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public void setPicture(File picture) {
this.picture = picture;
}
public File getPicture() {
return this.picture;
}
public void setPictureContentType(String pictureContentType) {
this.pictureContentType = pictureContentType;
}
public void setPictureFileName(String pictureFileName) {
this.pictureFileName = pictureFileName;
}
public void setFavouriteLanguage(String favouriteLanguage) {
this.favouriteLanguage = favouriteLanguage;
}
public String getFavouriteLanguage() {
return favouriteLanguage;
}
public void setThoughts(String thoughts) {
this.thoughts = thoughts;
}
public String getThoughts() {
return this.thoughts;
}
public Date getWakeup() {
return wakeup;
}
public void setWakeup(Date wakeup) {
this.wakeup = wakeup;
}
public String doSubmit() {
return SUCCESS;
}
// === inner class
public static class Language {
String description;
String key;
public Language(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() {
return key;
}
public String getDescription() {
return description;
}
}
public static class VehicalType {
String key;
String description;
public VehicalType(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() { return this.key; }
public String getDescription() { return this.description; }
public boolean equals(Object obj) {
if (! (obj instanceof VehicalType)) {
return false;
}
else {
return key.equals(((VehicalType)obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
public static class VehicalSpecific {
String key;
String description;
public VehicalSpecific(String key, String description) {
this.key = key;
this.description = description;
}
public String getKey() { return this.key; }
public String getDescription() { return this.description; }
public boolean equals(Object obj) {
if (! (obj instanceof VehicalSpecific)) {
return false;
}
else {
return key.equals(((VehicalSpecific)obj).getKey());
}
}
public int hashCode() {
return key.hashCode();
}
}
}
@@ -20,76 +20,78 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.ActionSupport;
import java.io.Serializable;
import java.util.Collection;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.model.IdEntity;
import java.io.Serializable;
import java.util.Collection;
import com.opensymphony.xwork2.ActionSupport;
/**
* AbstractCRUDAction.
*
*/
public abstract class AbstractCRUDAction extends ActionSupport {
private static final Logger log = Logger.getLogger(AbstractCRUDAction.class);
private static final Logger log = Logger.getLogger(AbstractCRUDAction.class);
private Collection availableItems;
private String[] toDelete;
private Collection availableItems;
private String[] toDelete;
protected abstract Dao getDao();
protected abstract Dao getDao();
public Collection getAvailableItems() {
return availableItems;
}
public Collection getAvailableItems() {
return availableItems;
}
public String[] getToDelete() {
return toDelete;
}
public String[] getToDelete() {
return toDelete;
}
public void setToDelete(String[] toDelete) {
this.toDelete = toDelete;
}
public void setToDelete(String[] toDelete) {
this.toDelete = toDelete;
}
public String list() throws Exception {
this.availableItems = getDao().findAll();
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [list]: " + (availableItems != null ? "" + availableItems.size() : "no") + " items found");
}
return execute();
}
public String list() throws Exception {
this.availableItems = getDao().findAll();
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [list]: " + (availableItems !=null?""+availableItems.size():"no") + " items found");
}
return execute();
}
public String delete() throws Exception {
if (toDelete != null) {
int count = 0;
for (int i = 0, j = toDelete.length; i < j; i++) {
count = count + getDao().delete(toDelete[i]);
}
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [delete]: " + count + " items deleted.");
}
}
return SUCCESS;
}
public String delete() throws Exception {
if (toDelete != null) {
int count=0;
for (int i = 0, j=toDelete.length; i < j; i++) {
count = count + getDao().delete(toDelete[i]);
}
if (log.isDebugEnabled()) {
log.debug("AbstractCRUDAction - [delete]: " + count + " items deleted.");
}
}
return SUCCESS;
}
/**
* Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle.
*
* @param tryId The id to try to get persistent object for
* @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent
* object for
* @return The persistent object, if found. <tt>null</tt> otherwise.
*/
protected IdEntity fetch(Serializable tryId, IdEntity tryObject) {
IdEntity result = null;
if (tryId != null) {
result = getDao().get(tryId);
} else if (tryObject != null) {
result = getDao().get(tryObject.getId());
}
return result;
}
/**
* Utility method for fetching already persistent object from storage for usage in params-prepare-params cycle.
*
* @param tryId The id to try to get persistent object for
* @param tryObject The object, induced by first params invocation, possibly containing id to try to get persistent
* object for
* @return The persistent object, if found. <tt>null</tt> otherwise.
*/
protected IdEntity fetch(Serializable tryId, IdEntity tryObject) {
IdEntity result = null;
if (tryId != null) {
result = getDao().get(tryId);
} else if (tryObject != null) {
result = getDao().get(tryObject.getId());
}
return result;
}
}
@@ -20,19 +20,19 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Preparable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.application.TestDataProvider;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.EmployeeDao;
import org.apache.struts2.showcase.model.Employee;
import org.apache.struts2.showcase.model.Skill;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import com.opensymphony.xwork2.Preparable;
/**
* JsfEmployeeAction.
@@ -40,82 +40,87 @@ import java.util.List;
public class EmployeeAction extends AbstractCRUDAction implements Preparable {
private static final long serialVersionUID = 7047317819789938957L;
private static final long serialVersionUID = 7047317819789938957L;
private static final Logger log = Logger.getLogger(EmployeeAction.class);
private static final Logger log = Logger.getLogger(EmployeeAction.class);
@Autowired
private EmployeeDao employeeDao;
private Long empId;
protected EmployeeDao employeeDao;
private Employee currentEmployee;
private List selectedSkills;
private Long empId;
private Employee currentEmployee;
private List<String> selectedSkills;
public Long getEmpId() {
return empId;
}
public String execute() throws Exception {
if (getCurrentEmployee() != null && getCurrentEmployee().getOtherSkills() != null) {
setSelectedSkills(new ArrayList<String>());
Iterator it = getCurrentEmployee().getOtherSkills().iterator();
while (it.hasNext()) {
getSelectedSkills().add(((Skill) it.next()).getName());
}
}
return super.execute();
}
public void setEmpId(Long empId) {
this.empId = empId;
}
public String save() throws Exception {
if (getCurrentEmployee() != null) {
setEmpId((Long) employeeDao.merge(getCurrentEmployee()));
employeeDao.setSkills(getEmpId(), getSelectedSkills());
}
return SUCCESS;
}
public Employee getCurrentEmployee() {
return currentEmployee;
}
public Long getEmpId() {
return empId;
}
public void setCurrentEmployee(Employee currentEmployee) {
this.currentEmployee = currentEmployee;
}
public void setEmpId(Long empId) {
this.empId = empId;
}
public String[] getAvailablePositions() {
return TestDataProvider.POSITIONS;
}
public Employee getCurrentEmployee() {
return currentEmployee;
}
public List getAvailableLevels() {
return Arrays.asList(TestDataProvider.LEVELS);
}
public void setCurrentEmployee(Employee currentEmployee) {
this.currentEmployee = currentEmployee;
}
public List getSelectedSkills() {
return selectedSkills;
}
public String[] getAvailablePositions() {
return TestDataProvider.POSITIONS;
}
public void setSelectedSkills(List selectedSkills) {
this.selectedSkills = selectedSkills;
}
public List getAvailableLevels() {
return Arrays.asList(TestDataProvider.LEVELS);
}
protected Dao getDao() {
return employeeDao;
}
public List<String> getSelectedSkills() {
return selectedSkills;
}
public void setEmployeeDao(EmployeeDao employeeDao) {
if (log.isDebugEnabled()) {
log.debug("JsfEmployeeAction - [setEmployeeDao]: employeeDao injected.");
}
this.employeeDao = employeeDao;
}
public void setSelectedSkills(List<String> selectedSkills) {
this.selectedSkills = selectedSkills;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Employee preFetched = (Employee) fetch(getEmpId(), getCurrentEmployee());
if (preFetched != null) {
setCurrentEmployee(preFetched);
}
}
protected Dao getDao() {
return employeeDao;
}
public String execute() throws Exception {
if (getCurrentEmployee() != null && getCurrentEmployee().getOtherSkills() != null) {
setSelectedSkills(new ArrayList());
Iterator it = getCurrentEmployee().getOtherSkills().iterator();
while (it.hasNext()) {
getSelectedSkills().add(((Skill) it.next()).getName());
}
}
return super.execute();
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Employee preFetched = (Employee) fetch(getEmpId(), getCurrentEmployee());
if (preFetched != null) {
setCurrentEmployee(preFetched);
}
}
public String save() throws Exception {
if (getCurrentEmployee() != null) {
setEmpId((Long) employeeDao.merge(getCurrentEmployee()));
employeeDao.setSkills(getEmpId(), getSelectedSkills());
}
return SUCCESS;
}
}
@@ -20,65 +20,69 @@
*/
package org.apache.struts2.showcase.action;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
import java.util.*;
public class ExampleAction extends ActionSupport {
public static final String CONSTANT = "Struts Rocks!";
public static final String CONSTANT = "Struts Rocks!";
public static Date getCurrentDate() {
return new Date();
}
public String getName() {
return "John Galt";
}
public static Date getCurrentDate() {
return new Date();
}
public String[] getBands() {
return new String[] { "Pink Floyd", "Metallica", "Guns & Roses" };
}
public String getName() {
return "John Galt";
}
public List<String> getMovies() {
return Arrays.asList("Lord of the Rings", "Matrix");
}
public String[] getBands() {
return new String[]{"Pink Floyd", "Metallica", "Guns & Roses"};
}
public Book getBook() {
return new Book("Iliad", "Homer");
}
public List<String> getMovies() {
return Arrays.asList("Lord of the Rings", "Matrix");
}
public Book getBook() {
return new Book("Iliad", "Homer");
}
public Map<String, Book> getBooks() {
Map<String, Book> books = new HashMap<String, Book>();
books.put("Iliad", new Book("Iliad", "Homer"));
books.put("The Republic", new Book("The Replublic", "Plato"));
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
"Friedrich Nietzsche"));
return books;
}
public Map<String, Book> getBooks() {
Map<String, Book> books = new HashMap<String, Book>();
books.put("Iliad", new Book("Iliad", "Homer"));
books.put("The Republic", new Book("The Replublic", "Plato"));
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
"Friedrich Nietzsche"));
return books;
}
}
class Book {
private String title;
private String author;
private String title;
private String author;
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public Book(String title, String author) {
this.title = title;
this.author = author;
}
public String getTitle() {
return title;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public void setAuthor(String author) {
this.author = author;
}
}
@@ -20,52 +20,58 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.interceptor.annotations.After;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
import org.apache.struts2.ServletActionContext;
import java.io.*;
import java.net.URL;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.interceptor.annotations.After;
/**
* Will only work on containers that unzip war files
*
*/
public class JSPEvalAction extends ExampleAction {
private String jsp;
private final static String FILE = "/interactive/demo.jsp";
private String jsp;
private final static String FILE = "/interactive/demo.jsp";
public String execute() throws IOException {
if (jsp != null) {
//write it to file
URL url = ServletActionContext.getServletContext().getResource(FILE);
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(url
.getFile())));
try {
//directive
writer.write("<%@ taglib prefix=\"s\" uri=\"/struts-tags\" %>");
writer.write(jsp);
} finally {
if (writer != null)
writer.close();
}
}
return Action.SUCCESS;
}
public String execute() throws IOException {
if (jsp != null) {
//write it to file
URL url = ServletActionContext.getServletContext().getResource(FILE);
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(url
.getFile())));
try {
//directive
writer.write("<%@ taglib prefix=\"s\" uri=\"/struts-tags\" %>");
writer.write(jsp);
} finally {
if (writer != null)
writer.close();
}
}
return Action.SUCCESS;
}
@After
public void cleanUp() throws IOException {
URL url = ServletActionContext.getServletContext().getResource(FILE);
FileOutputStream out = new FileOutputStream(new File(url.getFile()));
try {
out.getChannel().truncate(0);
} finally {
if (out != null)
out.close();
}
}
@After
public void cleanUp() throws IOException {
URL url = ServletActionContext.getServletContext().getResource(FILE);
FileOutputStream out = new FileOutputStream(new File(url.getFile()));
try {
out.getChannel().truncate(0);
} finally {
if (out != null)
out.close();
}
}
public void setJsp(String jsp) {
this.jsp = jsp;
}
public void setJsp(String jsp) {
this.jsp = jsp;
}
}
@@ -20,64 +20,70 @@
*/
package org.apache.struts2.showcase.action;
import com.opensymphony.xwork2.Preparable;
import org.apache.log4j.Logger;
import org.apache.struts2.showcase.dao.Dao;
import org.apache.struts2.showcase.dao.SkillDao;
import org.apache.struts2.showcase.model.Skill;
import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Preparable;
/**
* SkillAction.
*
*/
public class SkillAction extends AbstractCRUDAction implements Preparable {
private static final Logger log = Logger.getLogger(SkillAction.class);
private static final Logger log = Logger.getLogger(SkillAction.class);
@Autowired
private SkillDao skillDao;
private String skillName;
protected SkillDao skillDao;
private Skill currentSkill;
private String skillName;
private Skill currentSkill;
public String getSkillName() {
return skillName;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Skill preFetched = (Skill) fetch(getSkillName(), getCurrentSkill());
if (preFetched != null) {
setCurrentSkill(preFetched);
}
}
public void setSkillName(String skillName) {
this.skillName = skillName;
}
public String save() throws Exception {
if (getCurrentSkill() != null) {
setSkillName((String) skillDao.merge(getCurrentSkill()));
}
return SUCCESS;
}
protected Dao getDao() {
return skillDao;
}
public String getSkillName() {
return skillName;
}
public void setSkillDao(SkillDao skillDao) {
if (log.isDebugEnabled()) {
log.debug("SkillAction - [setSkillDao]: skillDao injected.");
}
this.skillDao = skillDao;
}
public void setSkillName(String skillName) {
this.skillName = skillName;
}
public Skill getCurrentSkill() {
return currentSkill;
}
protected Dao getDao() {
return skillDao;
}
public void setCurrentSkill(Skill currentSkill) {
this.currentSkill = currentSkill;
}
public Skill getCurrentSkill() {
return currentSkill;
}
/**
* This method is called to allow the action to prepare itself.
*
* @throws Exception thrown if a system level exception occurs.
*/
public void prepare() throws Exception {
Skill preFetched = (Skill) fetch(getSkillName(), getCurrentSkill());
if (preFetched != null) {
setCurrentSkill(preFetched);
}
}
public void setCurrentSkill(Skill currentSkill) {
this.currentSkill = currentSkill;
}
public String save() throws Exception {
if (getCurrentSkill() != null) {
setSkillName((String) skillDao.merge(getCurrentSkill()));
}
return SUCCESS;
}
}
@@ -22,21 +22,24 @@ package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
public class ActionChain1 extends ActionSupport {
private static final long serialVersionUID = -6811701750042275153L;
private static final long serialVersionUID = -6811701750042275153L;
private String actionChain1Property1 = "Property Set In Action Chain 1";
private String actionChain1Property1 = "Property Set In Action Chain 1";
public String input() throws Exception {
return SUCCESS;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String input() throws Exception {
return SUCCESS;
}
}
@@ -22,31 +22,37 @@ package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
public class ActionChain2 extends ActionSupport {
private static final long serialVersionUID = 3951745956044674809L;
private static final long serialVersionUID = 3951745956044674809L;
private String actionChain1Property1;
private String actionChain2Property1 = "Property Set in Action Chain 2";
public String execute() throws Exception {
return SUCCESS;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
private String actionChain1Property1;
private String actionChain2Property1 = "Property Set in Action Chain 2";
public String getActionChain2Property1() {
return actionChain2Property1;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String execute() throws Exception {
return SUCCESS;
}
}
@@ -22,42 +22,47 @@ package org.apache.struts2.showcase.actionchaining;
import com.opensymphony.xwork2.ActionSupport;
/**
*
*/
public class ActionChain3 extends ActionSupport {
private static final long serialVersionUID = -1456568865075250621L;
private static final long serialVersionUID = -1456568865075250621L;
private String actionChain1Property1;
private String actionChain2Property1;
private String actionChain3Property1 = "Property set in Action Chain 3";
private String actionChain1Property1;
private String actionChain2Property1;
private String actionChain3Property1 = "Property set in Action Chain 3";
public String execute() throws Exception {
return SUCCESS;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain1Property1() {
return actionChain1Property1;
}
public void setActionChain1Property1(String actionChain1Property1) {
this.actionChain1Property1 = actionChain1Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String getActionChain2Property1() {
return actionChain2Property1;
}
public void setActionChain2Property1(String actionChain2Property1) {
this.actionChain2Property1 = actionChain2Property1;
}
public String getActionChain3Property1() {
return actionChain3Property1;
}
public void setActionChain3Property1(String actionChain3Property1) {
this.actionChain3Property1 = actionChain3Property1;
}
public String getActionChain3Property1() {
return actionChain3Property1;
}
public void setActionChain3Property1(String actionChain3Property1) {
this.actionChain3Property1 = actionChain3Property1;
}
public String execute() throws Exception {
return SUCCESS;
}
}
@@ -25,28 +25,30 @@ import com.opensymphony.xwork2.Action;
import java.io.Serializable;
/**
*/
public class AjaxTestAction implements Action, Serializable {
private static int counter = 0;
private String data;
private static int counter = 0;
private String data;
public String execute() throws Exception {
return SUCCESS;
}
public long getServerTime() {
return System.currentTimeMillis();
}
public long getServerTime() {
return System.currentTimeMillis();
}
public int getCount() {
return ++counter;
}
public int getCount() {
return ++counter;
}
public String getData() {
return data;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public void setData(String data) {
this.data = data;
}
public String execute() throws Exception {
return SUCCESS;
}
}
@@ -20,40 +20,40 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import com.opensymphony.xwork2.ActionSupport;
public class AutocompleterExampleAction extends ActionSupport {
private String select;
private List<String> options = new ArrayList<String>();
private String select;
private List<String> options = new ArrayList<String>();
private static final long serialVersionUID = -8481638176160014396L;
private static final long serialVersionUID = -8481638176160014396L;
public String execute() throws Exception {
if ("fruits".equals(select)) {
options.add("apple");
options.add("banana");
options.add("grape");
options.add("pear");
} else if ("colors".equals(select)) {
options.add("red");
options.add("green");
options.add("blue");
}
return SUCCESS;
}
public String execute() throws Exception {
if ("fruits".equals(select)) {
options.add("apple");
options.add("banana");
options.add("grape");
options.add("pear");
} else if ("colors".equals(select)) {
options.add("red");
options.add("green");
options.add("blue");
}
return SUCCESS;
}
public String getSelect() {
return select;
}
public String getSelect() {
return select;
}
public void setSelect(String select) {
this.select = select;
}
public void setSelect(String select) {
this.select = select;
}
public List<String> getOptions() {
return options;
}
public List<String> getOptions() {
return options;
}
}
@@ -20,56 +20,56 @@
*/
package org.apache.struts2.showcase.ajax;
import com.opensymphony.xwork2.ActionSupport;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.opensymphony.xwork2.ActionSupport;
/**
* @version $Date$ $Id$
*/
public class Example4ShowPanelAction extends ActionSupport {
private String name;
private String gender;
private String name;
private String gender;
private static final long serialVersionUID = 7751976335066456596L;
private static final long serialVersionUID = 7751976335066456596L;
public String panel1() throws Exception {
return SUCCESS;
}
public String panel1() throws Exception {
return SUCCESS;
}
public String panel2() throws Exception {
return SUCCESS;
}
public String panel2() throws Exception {
return SUCCESS;
}
public String panel3() throws Exception {
return SUCCESS;
}
public String panel3() throws Exception {
return SUCCESS;
}
public String getGender() {
return gender;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getTodayDate() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
return sdf.format(new Date());
}
public String getTodayDate() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMMM-yyyy");
return sdf.format(new Date());
}
public String getTodayTime() {
SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
return sdf.format(new Date());
}
public String getTodayTime() {
SimpleDateFormat sdf = new SimpleDateFormat("kk:mm:ss");
return sdf.format(new Date());
}
}
@@ -24,28 +24,20 @@ import com.opensymphony.xwork2.ActionSupport;
public class Example5Action extends ActionSupport {
private static final long serialVersionUID = 2111967621952300611L;
private static final long serialVersionUID = 2111967621952300611L;
private String name;
private Integer age;
private String name;
private Integer age;
public String execute() throws Exception {
return SUCCESS;
}
public String getName() {
return name;
}
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public void setName(String name) {
this.name = name;
}
public Integer getAge() { return age; }
public void setAge(Integer age) { this.age = age; }
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
@Override
public String execute() throws Exception {
return SUCCESS;
}
}
@@ -28,77 +28,77 @@ import java.util.Map;
/**
*/
public class Category {
private static Map<Long, Category> catMap = new HashMap<Long, Category>();
private static Map<Long, Category> catMap = new HashMap<Long, Category>();
static {
new Category(1, "Root",
new Category(2, "Java",
new Category(3, "Web Frameworks",
new Category(4, "Struts"),
new Category(7, "Stripes"),
new Category(8, "Rife")),
new Category(9, "Persistence",
new Category(10, "iBatis"),
new Category(11, "Hibernate"),
new Category(12, "JDO"),
new Category(13, "JDBC"))),
new Category(14, "JavaScript",
new Category(15, "Dojo"),
new Category(16, "Prototype"),
new Category(17, "Scriptaculous"),
new Category(18, "OpenRico"),
new Category(19, "DWR")));
}
static {
new Category(1, "Root",
new Category(2, "Java",
new Category(3, "Web Frameworks",
new Category(4, "Struts"),
new Category(7, "Stripes"),
new Category(8, "Rife")),
new Category(9, "Persistence",
new Category(10, "iBatis"),
new Category(11, "Hibernate"),
new Category(12, "JDO"),
new Category(13, "JDBC"))),
new Category(14, "JavaScript",
new Category(15, "Dojo"),
new Category(16, "Prototype"),
new Category(17, "Scriptaculous"),
new Category(18, "OpenRico"),
new Category(19, "DWR")));
}
public static Category getById(long id) {
return catMap.get(id);
}
public static Category getById(long id) {
return catMap.get(id);
}
private long id;
private String name;
private List<Category> children;
private boolean toggle;
private long id;
private String name;
private List<Category> children;
private boolean toggle;
public Category(long id, String name, Category... children) {
this.id = id;
this.name = name;
this.children = new ArrayList<Category>();
for (Category child : children) {
this.children.add(child);
}
public Category(long id, String name, Category... children) {
this.id = id;
this.name = name;
this.children = new ArrayList<Category>();
for (Category child : children) {
this.children.add(child);
}
catMap.put(id, this);
}
catMap.put(id, this);
}
public long getId() {
return id;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public List<Category> getChildren() {
return children;
}
public List<Category> getChildren() {
return children;
}
public void setChildren(List<Category> children) {
this.children = children;
}
public void setChildren(List<Category> children) {
this.children = children;
}
public void toggle() {
toggle = !toggle;
}
public void toggle() {
toggle = !toggle;
}
public boolean isToggle() {
return toggle;
}
public boolean isToggle() {
return toggle;
}
}
@@ -25,25 +25,25 @@ import com.opensymphony.xwork2.ActionSupport;
/**
*/
public class GetCategory extends ActionSupport {
private long catId;
private Category category;
private long catId;
private Category category;
public String execute() throws Exception {
if (catId < 1) {
// force the root
catId = 1;
}
public String execute() throws Exception {
if (catId < 1) {
// force the root
catId = 1;
}
category = Category.getById(catId);
category = Category.getById(catId);
return SUCCESS;
}
return SUCCESS;
}
public void setCatId(long catId) {
this.catId = catId;
}
public void setCatId(long catId) {
this.catId = catId;
}
public Category getCategory() {
return category;
}
public Category getCategory() {
return category;
}
}

Some files were not shown because too many files have changed in this diff Show More