You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by dd...@apache.org on 2006/12/01 04:21:54 UTC
svn commit: r481136 - in /struts/struts2/trunk/apps/showcase/src/main:
java/org/apache/struts2/showcase/freemarker/ resources/ webapp/freemarker/
webapp/tiles/
Author: ddewolf
Date: Thu Nov 30 19:21:53 2006
New Revision: 481136
URL: http://svn.apache.org/viewvc?view=rev&rev=481136
Log:
Fixing freemarker showcase and adding freemarker standard tag showcase
Added:
struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java (with props)
struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/standardTags.ftl
Modified:
struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java
struts/struts2/trunk/apps/showcase/src/main/resources/struts-freemarker.xml
struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp
struts/struts2/trunk/apps/showcase/src/main/webapp/tiles/body.ftl
Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java?view=diff&rev=481136&r1=481135&r2=481136
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java (original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/CustomFreemarkerManager.java Thu Nov 30 19:21:53 2006
@@ -27,6 +27,7 @@
import org.apache.struts2.views.freemarker.ScopesHashModel;
import com.opensymphony.xwork2.util.OgnlValueStack;
+import com.opensymphony.xwork2.util.ValueStack;
/**
* This is an example of a custom FreemarkerManager, mean to be
@@ -50,7 +51,7 @@
this.util = util;
}
- public void populateContext(ScopesHashModel model, OgnlValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) {
+ protected void populateContext(ScopesHashModel model, ValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) {
super.populateContext(model, stack, action, request, response);
model.put("customFreemarkerManagerUtil", util);
}
Added: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java?view=auto&rev=481136
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java (added)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java Thu Nov 30 19:21:53 2006
@@ -0,0 +1,47 @@
+package org.apache.struts2.showcase.freemarker;
+
+import com.opensymphony.xwork2.ActionSupport;
+import com.opensymphony.xwork2.Preparable;
+
+import java.text.DateFormatSymbols;
+
+/**
+ * Showcase action for freemarker templates.
+ */
+public class StandardTagsAction extends ActionSupport implements Preparable {
+
+ private String name;
+ private String[] gender;
+ private String[] months;
+
+ public void prepare() {
+ months = new DateFormatSymbols().getMonths();
+ name = StandardTagsAction.class.getName().substring(StandardTagsAction.class.getName().lastIndexOf(".")+1);
+ gender = new String[] { "Male", "Femal" };
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String[] getMonths() {
+ return months;
+ }
+
+ public void setMonths(String[] months) {
+ this.months = months;
+ }
+
+
+ public String[] getGender() {
+ return gender;
+ }
+
+ public void setGender(String[] gender) {
+ this.gender = gender;
+ }
+}
Propchange: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/freemarker/StandardTagsAction.java
------------------------------------------------------------------------------
svn:keywords = Id Author Date Rev
Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts-freemarker.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts-freemarker.xml?view=diff&rev=481136&r1=481135&r2=481136
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts-freemarker.xml (original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts-freemarker.xml Thu Nov 30 19:21:53 2006
@@ -1,14 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
-
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
<struts>
- <package name="freemarker" namespace="/freemarker" extends="struts-default">
- <action name="customFreemarkerManagerDemo">
- <result type="freemarker">/freemarker/customFreemarkerManagerUsage.ftl</result>
- </action>
- </package>
+ <package name="freemarker" namespace="/freemarker" extends="struts-default">
+ <action name="customFreemarkerManagerDemo">
+ <result type="freemarker">/freemarker/customFreemarkerManagerUsage.ftl</result>
+ </action>
+
+ <action name="standardTags" class="org.apache.struts2.showcase.freemarker.StandardTagsAction">
+ <result type="freemarker">/freemarker/standardTags.ftl</result>
+ </action>
+ </package>
</struts>
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp?view=diff&rev=481136&r1=481135&r2=481136
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/index.jsp Thu Nov 30 19:21:53 2006
@@ -11,6 +11,9 @@
<li>
<s:url id="url" action="customFreemarkerManagerDemo" namespace="/freemarker" />
<s:a href="%{#url}">Demo of usage of a Custom Freemarker Manager</s:a>
+ <p/>
+ <s:url id="url" action="standardTags" namespace="/freemarker" />
+ <s:a href="%{#url}">Demo of Standard Struts Freemarker Tags</s:a>
</li>
</ul>
Added: struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/standardTags.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/standardTags.ftl?view=auto&rev=481136
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/standardTags.ftl (added)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/standardTags.ftl Thu Nov 30 19:21:53 2006
@@ -0,0 +1,4 @@
+<@s.form action="test">
+ <@s.textfield label="Name" name="name"/>
+ <@s.select label="Birth Month" headerValue="Select Month" list="months" />
+</...@s.form>
\ No newline at end of file
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tiles/body.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tiles/body.ftl?view=diff&rev=481136&r1=481135&r2=481136
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tiles/body.ftl (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tiles/body.ftl Thu Nov 30 19:21:53 2006
@@ -3,4 +3,8 @@
<p>Tiles 2 is an effort to extract the Tiles library from Struts. It is currently housed
in the Sandbox area of the Apache Struts Subversion repository.</p>
+
+ <@s.form>
+ <@s.textfield name="Textfield" value="Textfield"/>
+ </...@s.form>
</div>