Commits

Anonymous committed e59ac0d

got the label stuff working better now... just gotta do this for all of them

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@117573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (7)

Add a comment to this file

lib/core/xwork-1.0-beta.jar

Binary file modified.

src/java/com/opensymphony/webwork/views/velocity/WebWorkVelocityContext.java

             }
         }
     }
+
+    public Object internalPut(String string, Object object) {
+        return super.internalPut(string, object);
+    }
 }

src/java/templates/xhtml/label.vm

 #parse( "/templates/xhtml/controlheader.vm" )
-$!{tag.params.get('name')}
+#set ($a = ${tag.params.get('value')})
+#if (!$a)
+    #set ($a = $stack.findValue(${tag.params.get('name')}))
+#end
+$!{stack.findValue($a)}
 #parse( "/templates/xhtml/controlfooter.vm" )

src/test/com/opensymphony/webwork/TestAction.java

         return result;
     }
 
-    public String getText(String text) {
-        return "{" + text + "}";
-    }
-
     public String execute() throws Exception {
         if (result == null) {
             result = Action.SUCCESS;

src/test/com/opensymphony/webwork/views/jsp/ui/Label-1.txt

 <tr>
-  <td align="right" valign="top"><label class="label">{mylabel}:</label></td>
+  <td align="right" valign="top"><label class="label">mylabel:</label></td>
   <td>
 bar
   </td>

src/test/com/opensymphony/webwork/views/jsp/ui/Label-2.txt

+<tr>
+  <td align="right" valign="top"><label class="label">mylabel:</label></td>
+  <td>
+baz
+  </td>
+</tr>

src/test/com/opensymphony/webwork/views/jsp/ui/LabelTest.java

 
         verify(LabelTest.class.getResource("Label-1.txt"));
     }
+
+    public void testWithValue() throws Exception {
+        Template template = Velocity.getTemplate(AbstractUITag.THEME + LabelTag.TEMPLATE);
+        Assert.assertNotNull(template); // ensure this is a valid decorators
+
+        TestAction testAction = (TestAction) action;
+        testAction.setFoo("baz");
+
+        LabelTag tag = new LabelTag();
+        tag.setPageContext(pageContext);
+        tag.setLabel("'mylabel'");
+        tag.setName("'foo'");
+
+        int result = tag.doEndTag();
+
+        verify(LabelTest.class.getResource("Label-2.txt"));
+    }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.