You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by cn...@apache.org on 2016/02/03 14:20:39 UTC

[02/10] struts git commit: WW-4606 added @TilesDefinition sample to showcase app

WW-4606 added @TilesDefinition sample to showcase app


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

Branch: refs/heads/support-2-3
Commit: 9a8f36dee2e28d95a08864dd69727d093b12ced3
Parents: a6345e7
Author: cnenning <cn...@apache.org>
Authored: Fri Jan 22 15:27:50 2016 +0100
Committer: cnenning <cn...@apache.org>
Committed: Wed Feb 3 13:21:59 2016 +0100

----------------------------------------------------------------------
 .../showcase/tiles/TilesAnnotationsAction.java  | 21 ++++++++++++++++++++
 apps/showcase/src/main/webapp/WEB-INF/tiles.xml |  6 ++++++
 .../src/main/webapp/WEB-INF/tiles/body.jsp      |  3 +++
 .../webapp/WEB-INF/tiles/layout-annotations.jsp | 14 +++++++++++++
 4 files changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/9a8f36de/apps/showcase/src/main/java/org/apache/struts2/showcase/tiles/TilesAnnotationsAction.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/tiles/TilesAnnotationsAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/tiles/TilesAnnotationsAction.java
new file mode 100644
index 0000000..997db11
--- /dev/null
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/tiles/TilesAnnotationsAction.java
@@ -0,0 +1,21 @@
+package org.apache.struts2.showcase.tiles;
+
+import org.apache.struts2.convention.annotation.Namespace;
+import org.apache.struts2.convention.annotation.ParentPackage;
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.tiles.annotation.TilesDefinition;
+import org.apache.struts2.tiles.annotation.TilesPutAttribute;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+@Namespace("/tiles")
+@ParentPackage("tiles")
+@Result(name = "success", type="tiles")
+@TilesDefinition(extend = "showcase.annotations", putAttributes = {
+        @TilesPutAttribute(name = "header", value = "/WEB-INF/tiles/header.jsp"),
+        @TilesPutAttribute(name = "body", value = "/WEB-INF/tiles/body.ftl"), })
+public class TilesAnnotationsAction extends ActionSupport {
+
+    private static final long serialVersionUID = 2900509995064928866L;
+
+}

http://git-wip-us.apache.org/repos/asf/struts/blob/9a8f36de/apps/showcase/src/main/webapp/WEB-INF/tiles.xml
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/webapp/WEB-INF/tiles.xml b/apps/showcase/src/main/webapp/WEB-INF/tiles.xml
index 7c7057f..0a1b1be 100644
--- a/apps/showcase/src/main/webapp/WEB-INF/tiles.xml
+++ b/apps/showcase/src/main/webapp/WEB-INF/tiles.xml
@@ -45,4 +45,10 @@
         <put-attribute name="body" value="/WEB-INF/tiles/body.ftl"/>
     </definition>
 
+    <definition name="showcase.annotations" template="/WEB-INF/tiles/layout-annotations.jsp">
+        <put-attribute name="title" value="Tiles Annotations Showcase"/>
+        <put-attribute name="header" value=".header"/>
+        <put-attribute name="body" value=".body"/>
+    </definition>
+
 </tiles-definitions>

http://git-wip-us.apache.org/repos/asf/struts/blob/9a8f36de/apps/showcase/src/main/webapp/WEB-INF/tiles/body.jsp
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/webapp/WEB-INF/tiles/body.jsp b/apps/showcase/src/main/webapp/WEB-INF/tiles/body.jsp
index 095762f..0a5ffe8 100644
--- a/apps/showcase/src/main/webapp/WEB-INF/tiles/body.jsp
+++ b/apps/showcase/src/main/webapp/WEB-INF/tiles/body.jsp
@@ -16,6 +16,9 @@
 					<li>
 						<a href="freemarkerLayout.action">View Example with a FreeMarker Layout</a>
 					</li>
+					<li>
+						<a href="tiles-annotations.action">View Example with tiles configuration by annotating action</a>
+					</li>
 				</ul>
 
 			</div>

http://git-wip-us.apache.org/repos/asf/struts/blob/9a8f36de/apps/showcase/src/main/webapp/WEB-INF/tiles/layout-annotations.jsp
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/webapp/WEB-INF/tiles/layout-annotations.jsp b/apps/showcase/src/main/webapp/WEB-INF/tiles/layout-annotations.jsp
new file mode 100644
index 0000000..5609cb1
--- /dev/null
+++ b/apps/showcase/src/main/webapp/WEB-INF/tiles/layout-annotations.jsp
@@ -0,0 +1,14 @@
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<%-- Show usage; Used in Header --%>
+<tiles:importAttribute name="title" scope="request"/>
+<html>
+    <head><title>Struts2 Showcase - <tiles:getAsString name="title"/></title></head>
+<body>
+    <tiles:insertAttribute name="header"/>
+    <tiles:insertAttribute name="body"/>
+    <p>Notice that this is a layout made in JSP</p>
+    <p>It is configured with <strong>annotations!</strong></p>
+</body>
+</html>