You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2017/03/28 08:36:01 UTC

[1/2] struts-examples git commit: Adds new example app

Repository: struts-examples
Updated Branches:
  refs/heads/master 1b98fdcdd -> 7882b0de5


Adds new example app


Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/7a58d1eb
Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/7a58d1eb
Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/7a58d1eb

Branch: refs/heads/master
Commit: 7a58d1eb83f7eac76fb6be604743867c3d7e4318
Parents: 1b98fdc
Author: Lukasz Lenart <lu...@gmail.com>
Authored: Tue Mar 28 10:34:15 2017 +0200
Committer: Lukasz Lenart <lu...@gmail.com>
Committed: Tue Mar 28 10:34:15 2017 +0200

----------------------------------------------------------------------
 pom.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7a58d1eb/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 496c84e..31f9c32 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,6 +43,7 @@
     </properties>
 
     <modules>
+        <module>action-chaining</module>
         <module>annotations</module>
         <module>basic-struts</module>
         <module>bean-validation</module>


[2/2] struts-examples git commit: Adds action chaining example

Posted by lu...@apache.org.
Adds action chaining example


Project: http://git-wip-us.apache.org/repos/asf/struts-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts-examples/commit/7882b0de
Tree: http://git-wip-us.apache.org/repos/asf/struts-examples/tree/7882b0de
Diff: http://git-wip-us.apache.org/repos/asf/struts-examples/diff/7882b0de

Branch: refs/heads/master
Commit: 7882b0de502250d647ca1f2e84d2b7605519209c
Parents: 7a58d1e
Author: Lukasz Lenart <lu...@gmail.com>
Authored: Tue Mar 28 10:35:44 2017 +0200
Committer: Lukasz Lenart <lu...@gmail.com>
Committed: Tue Mar 28 10:35:44 2017 +0200

----------------------------------------------------------------------
 action-chaining/pom.xml                         | 47 ++++++++++++++++++++
 .../org/apache/struts_examples/ActionA.java     | 41 +++++++++++++++++
 .../org/apache/struts_examples/ActionB.java     | 41 +++++++++++++++++
 action-chaining/src/main/resources/struts.xml   | 31 +++++++++++++
 .../src/main/webapp/WEB-INF/ActionB.jsp         | 14 ++++++
 .../src/main/webapp/WEB-INF/index.jsp           | 13 ++++++
 action-chaining/src/main/webapp/WEB-INF/web.xml | 23 ++++++++++
 7 files changed, 210 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/pom.xml
----------------------------------------------------------------------
diff --git a/action-chaining/pom.xml b/action-chaining/pom.xml
new file mode 100644
index 0000000..b5d17df
--- /dev/null
+++ b/action-chaining/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>struts-examples</artifactId>
+        <groupId>org.apache.struts</groupId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>action-chaining</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>war</packaging>
+    <name>Action chaining</name>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.3</version>
+                <configuration>
+                    <encoding>UTF-8</encoding>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>jetty-maven-plugin</artifactId>
+                <version>8.1.16.v20140903</version>
+                <configuration>
+                    <stopKey>CTRL+C</stopKey>
+                    <stopPort>8999</stopPort>
+                    <scanIntervalSeconds>10</scanIntervalSeconds>
+                    <webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
+                    <webAppConfig>
+                        <descriptor>${basedir}/src/main/webapp/WEB-INF/web.xml</descriptor>
+                    </webAppConfig>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/src/main/java/org/apache/struts_examples/ActionA.java
----------------------------------------------------------------------
diff --git a/action-chaining/src/main/java/org/apache/struts_examples/ActionA.java b/action-chaining/src/main/java/org/apache/struts_examples/ActionA.java
new file mode 100644
index 0000000..3b85511
--- /dev/null
+++ b/action-chaining/src/main/java/org/apache/struts_examples/ActionA.java
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts_examples;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ActionA extends ActionSupport {
+
+    private String name;
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/src/main/java/org/apache/struts_examples/ActionB.java
----------------------------------------------------------------------
diff --git a/action-chaining/src/main/java/org/apache/struts_examples/ActionB.java b/action-chaining/src/main/java/org/apache/struts_examples/ActionB.java
new file mode 100644
index 0000000..1daaa46
--- /dev/null
+++ b/action-chaining/src/main/java/org/apache/struts_examples/ActionB.java
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.struts_examples;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ActionB extends ActionSupport {
+
+    private String name;
+
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/src/main/resources/struts.xml
----------------------------------------------------------------------
diff --git a/action-chaining/src/main/resources/struts.xml b/action-chaining/src/main/resources/struts.xml
new file mode 100644
index 0000000..7e425ec
--- /dev/null
+++ b/action-chaining/src/main/resources/struts.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
+        "http://struts.apache.org/dtds/struts-2.5.dtd">
+<struts>
+    <constant name="struts.enable.DynamicMethodInvocation" value="false"/>
+    <constant name="struts.devMode" value="true"/>
+
+    <package name="default" namespace="/" extends="struts-default">
+
+        <default-action-ref name="index"/>
+
+        <action name="index">
+            <result>WEB-INF/index.jsp</result>
+        </action>
+
+        <action name="actionA" class="org.apache.struts_examples.ActionA">
+            <param name="name">Chain from A to B</param>
+            <result name="success" type="chain">
+                <param name="actionName">actionB</param>
+            </result>
+        </action>
+
+        <action name="actionB" class="org.apache.struts_examples.ActionB">
+            <result>WEB-INF/ActionB.jsp</result>
+        </action>
+
+    </package>
+
+    <!-- Add addition packages and configuration here. -->
+</struts>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/src/main/webapp/WEB-INF/ActionB.jsp
----------------------------------------------------------------------
diff --git a/action-chaining/src/main/webapp/WEB-INF/ActionB.jsp b/action-chaining/src/main/webapp/WEB-INF/ActionB.jsp
new file mode 100644
index 0000000..30027af
--- /dev/null
+++ b/action-chaining/src/main/webapp/WEB-INF/ActionB.jsp
@@ -0,0 +1,14 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html>
+<head>
+    <title>Action B</title>
+</head>
+
+<body>
+
+<h2>Value from Action A: <s:property value="name"/></h2>
+
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/src/main/webapp/WEB-INF/index.jsp
----------------------------------------------------------------------
diff --git a/action-chaining/src/main/webapp/WEB-INF/index.jsp b/action-chaining/src/main/webapp/WEB-INF/index.jsp
new file mode 100644
index 0000000..440030f
--- /dev/null
+++ b/action-chaining/src/main/webapp/WEB-INF/index.jsp
@@ -0,0 +1,13 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<html>
+<head>
+    <title>Action Chaining</title>
+</head>
+
+<body>
+
+<s:a action="actionA">Action A</s:a>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/struts-examples/blob/7882b0de/action-chaining/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/action-chaining/src/main/webapp/WEB-INF/web.xml b/action-chaining/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..8858656
--- /dev/null
+++ b/action-chaining/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="struts_blank" 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>
+
+  <filter>
+    <filter-name>struts2</filter-name>
+    <filter-class>
+      org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
+    </filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>struts2</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+  </welcome-file-list>
+</web-app>