You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2006/08/24 02:16:36 UTC
svn commit: r434265 [1/2] - in /struts/struts2/trunk:
apps/showcase/src/main/webapp/tags/ui/
core/src/main/java/org/apache/struts2/components/
core/src/main/java/org/apache/struts2/views/jsp/ui/
core/src/main/java/org/apache/struts2/views/velocity/comp...
Author: husted
Date: Wed Aug 23 17:16:35 2006
New Revision: 434265
URL: http://svn.apache.org/viewvc?rev=434265&view=rev
Log:
WW-1392 Bring over WW2.2.3 TLD. Review commit history. Add missing attribute (doubleAccesskey) and missing tag (debug). (Next: Update with example code.) Also change Velocity directive prefix from "s-" to "s", since the using special character wasn't working.
Added:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java
Modified:
struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm
struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java
struts/struts2/trunk/core/src/main/resources/META-INF/struts-tags.tld
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm?rev=434265&r1=434264&r2=434265&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/example.vm Wed Aug 23 17:16:35 2006
@@ -1,32 +1,32 @@
<html>
<head>
<title>UI Tags Example</title>
- #safhead()
+ #shead()
</head>
<body>
-#safurl ("id=url" "value=index.jsp")
+#surl ("id=url" "value=index.jsp")
<a href="${url}">Back to index.jsp</a>!
-#safform ("action=exampleSubmitVelocity" "method=post" "enctype=multipart/form-data")
- #saftextfield ("label=Name" "name=name")
- #safdatepicker ("label=Birthday" "name=birthday")
- #saftextarea ("label=Biograph" "name=bio" "cols=20" "rows=3")
- #safselect ("label=Favorite Color" "list={'Red', 'Blue', 'Green'}" "name=favoriteColor" "emptyOption=true" "headerKey=None" "headerValue=None")
- #safselect ("label=Favourite Language" "list=favouriteLanguages" "name=favouriteLanguage" "listKey=key" "listValue=description" "emptyOption=true" "headerKey=None" "headerValue=None")
- #safcheckboxlist ("label=Friends" "list={'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=friends")
- #safcheckbox ("label=Age 18+" "name=legalAge")
- #safdoubleselect ("label=State" "name=region" "list={'North', 'South'}" "value='North'" "doubleValue='Florida'" "doubleList=top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" "doubleName=state" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
- #safdoubleselect ("label=Favourite Vehical" "name=favouriteVehicalType" "list=vehicalTypeList" "listKey=key" "listValue=description" "value='MotorcycleKey'" "doubleValue='YamahaKey'" "doubleList=vehicalSpecificList" "doubleListKey=key" "doubleListValue=description" "doubleName=favouriteVehicalSpecific" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
- #saffile ("label=Picture" "name=picture")
- #safoptiontransferselect ("label=Favourite Cartoons Characters" "name=leftSideCartoonCharacters" "leftTitle=Left Title" "rightTitle=Right Title" "list={'Popeye', 'He-Man', 'Spiderman'}" "multiple=true" "headerKey=headerKey" "headerValue=--- Please Select ---" "emptyOption=true" "doubleList={'Superman', 'Mickey Mouse', 'Donald Duck'}" "doubleName=rightSideCartoonCharacters" "doubleHeaderKey=doubleHeaderKey" "doubleHeaderValue=--- Please Select ---" "doubleEmptyOption=true" "doubleMultiple=true" )
- #safsubmit()
- #safreset()
+#sform ("action=exampleSubmitVelocity" "method=post" "enctype=multipart/form-data")
+ #stextfield ("label=Name" "name=name")
+ #sdatepicker ("label=Birthday" "name=birthday")
+ #stextarea ("label=Biograph" "name=bio" "cols=20" "rows=3")
+ #sselect ("label=Favorite Color" "list={'Red', 'Blue', 'Green'}" "name=favoriteColor" "emptyOption=true" "headerKey=None" "headerValue=None")
+ #sselect ("label=Favourite Language" "list=favouriteLanguages" "name=favouriteLanguage" "listKey=key" "listValue=description" "emptyOption=true" "headerKey=None" "headerValue=None")
+ #scheckboxlist ("label=Friends" "list={'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=friends")
+ #scheckbox ("label=Age 18+" "name=legalAge")
+ #sdoubleselect ("label=State" "name=region" "list={'North', 'South'}" "value='North'" "doubleValue='Florida'" "doubleList=top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" "doubleName=state" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
+ #sdoubleselect ("label=Favourite Vehical" "name=favouriteVehicalType" "list=vehicalTypeList" "listKey=key" "listValue=description" "value='MotorcycleKey'" "doubleValue='YamahaKey'" "doubleList=vehicalSpecificList" "doubleListKey=key" "doubleListValue=description" "doubleName=favouriteVehicalSpecific" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
+ #sfile ("label=Picture" "name=picture")
+ #soptiontransferselect ("label=Favourite Cartoons Characters" "name=leftSideCartoonCharacters" "leftTitle=Left Title" "rightTitle=Right Title" "list={'Popeye', 'He-Man', 'Spiderman'}" "multiple=true" "headerKey=headerKey" "headerValue=--- Please Select ---" "emptyOption=true" "doubleList={'Superman', 'Mickey Mouse', 'Donald Duck'}" "doubleName=rightSideCartoonCharacters" "doubleHeaderKey=doubleHeaderKey" "doubleHeaderValue=--- Please Select ---" "doubleEmptyOption=true" "doubleMultiple=true" )
+ #ssubmit()
+ #sreset()
#end
-#safa("href=${url}")Back to index.jsp#end
+#sa("href=${url}")Back to index.jsp#end
</body>
</html>
Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm?rev=434265&r1=434264&r2=434265&view=diff
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm (original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/exampleSubmited.vm Wed Aug 23 17:16:35 2006
@@ -6,18 +6,18 @@
<h1>Example Submitted</h1>
<table>
- #saflabel ("label=Name" "name=name")
- #saflabel ("label=Birthday" "name=birthday")
- #saflabel ("label=Biography" "name=bio")
- #saflabel ("label=Favourite Color" "name=favouriteColor")
- #saflabel ("label=Friends" "name=friends")
- #saflabel ("label=Legal Age" "name=legalAge")
- #saflabel ("label=Region" "name=region")
- #saflabel ("label=State" "name=state")
- #saflabel ("label=Picture" "name=picture")
- #saflabel ("label=Favourite Language" "name=favouriteLanguage")
- #saflabel ("label=Favourite Vehical Type" "name=favouriteVehicalType")
- #saflabel ("label=Favourite Vehical Specific" "name=favouriteVehicalSpecific")
+ #slabel ("label=Name" "name=name")
+ #slabel ("label=Birthday" "name=birthday")
+ #slabel ("label=Biography" "name=bio")
+ #slabel ("label=Favourite Color" "name=favouriteColor")
+ #slabel ("label=Friends" "name=friends")
+ #slabel ("label=Legal Age" "name=legalAge")
+ #slabel ("label=Region" "name=region")
+ #slabel ("label=State" "name=state")
+ #slabel ("label=Picture" "name=picture")
+ #slabel ("label=Favourite Language" "name=favouriteLanguage")
+ #slabel ("label=Favourite Vehical Type" "name=favouriteVehicalType")
+ #slabel ("label=Favourite Vehical Specific" "name=favouriteVehicalSpecific")
<tr>
<td>Favourite Cartoon Characters (Left):</td>
<td>
@@ -40,8 +40,8 @@
</tr>
</table>
-#safurl ("id=url" "value=index.jsp")
-#safa("href=${url}")Back to index.jsp#end
+#surl ("id=url" "value=index.jsp")
+#sa("href=${url}")Back to index.jsp#end
</body>
</html>
Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java?rev=434265&view=auto
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java (added)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Debug.java Wed Aug 23 17:16:35 2006
@@ -0,0 +1,94 @@
+package org.apache.struts2.components;
+
+import com.opensymphony.xwork2.util.OgnlUtil;
+import com.opensymphony.xwork2.util.OgnlValueStack;
+import org.apache.struts2.StrutsException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <!-- START SNIPPET: javadoc -->
+ * <p>Renders an debug tag.</P>
+ *
+ * The debug information contain mostly stack information:
+ * <ul>
+ * <li>Value Stack Contents</li>
+ * <li>Stack Context</li>
+ * </ul>
+ * <!-- END SNIPPET: javadoc -->
+ *
+ * <p/> <b>Examples</b>
+ *
+ * <pre>
+ * <!-- START SNIPPET: example -->
+ * <ww:debug/>
+ * <!-- END SNIPPET: example -->
+ * </pre>
+ *
+ * @s.tag name="debug" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.DebugTag"
+ * description="Render debug tag"
+ */
+public class Debug extends UIBean {
+ public static final String TEMPLATE = "debug";
+
+ public Debug(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) {
+ super(stack, request, response);
+ }
+
+ protected String getDefaultTemplate() {
+ return TEMPLATE;
+ }
+
+ public boolean start(Writer writer) {
+ boolean result = super.start(writer);
+
+ OgnlValueStack stack = getStack();
+ Iterator iter = stack.getRoot().iterator();
+ List stackValues = new ArrayList(stack.getRoot().size());
+ while (iter.hasNext()) {
+ Object o = iter.next();
+ Map values;
+ try {
+ values = OgnlUtil.getBeanMap(o);
+ } catch (Exception e) {
+ throw new StrutsException("Caught an exception while getting the property values of " + o, e);
+ }
+ stackValues.add(new DebugMapEntry(o.getClass().getName(), values));
+ }
+
+ addParameter("stackValues", stackValues);
+
+ return result;
+ }
+
+ private class DebugMapEntry implements Map.Entry {
+ private Object key;
+ private Object value;
+
+ DebugMapEntry(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object newVal) {
+ Object oldVal = value;
+ value = newVal;
+ return oldVal;
+ }
+ }
+
+}
Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java?rev=434265&view=auto
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java (added)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/jsp/ui/DebugTag.java Wed Aug 23 17:16:35 2006
@@ -0,0 +1,16 @@
+package org.apache.struts2.views.jsp.ui;
+
+import org.apache.struts2.components.Component;
+import org.apache.struts2.components.Debug;
+import com.opensymphony.xwork2.util.OgnlValueStack;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class DebugTag extends AbstractUITag {
+
+ public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) {
+ return new Debug(stack, req, res);
+ }
+
+}
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java?rev=434265&r1=434264&r2=434265&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/components/AbstractDirective.java Wed Aug 23 17:16:35 2006
@@ -36,7 +36,7 @@
public abstract class AbstractDirective extends Directive {
public String getName() {
- return "s-" + getBeanName();
+ return "s" + getBeanName();
}
public abstract String getBeanName();