velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r547128 - in /velocity/tools/branches/2.x/examples/simple: WEB-INF/toolbox.xml index.jsp index.vm
Date Thu, 14 Jun 2007 05:36:40 GMT
Author: nbubna
Date: Wed Jun 13 22:36:39 2007
New Revision: 547128

URL: http://svn.apache.org/viewvc?view=rev&rev=547128
Log:
add basic Veltag use to the simple app

Added:
    velocity/tools/branches/2.x/examples/simple/index.jsp   (with props)
Modified:
    velocity/tools/branches/2.x/examples/simple/WEB-INF/toolbox.xml
    velocity/tools/branches/2.x/examples/simple/index.vm

Modified: velocity/tools/branches/2.x/examples/simple/WEB-INF/toolbox.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/examples/simple/WEB-INF/toolbox.xml?view=diff&rev=547128&r1=547127&r2=547128
==============================================================================
--- velocity/tools/branches/2.x/examples/simple/WEB-INF/toolbox.xml (original)
+++ velocity/tools/branches/2.x/examples/simple/WEB-INF/toolbox.xml Wed Jun 13 22:36:39 2007
@@ -24,12 +24,12 @@
   <tool>
      <key>toytool</key>
      <scope>request</scope>
-     <request-path>index.vm</request-path>
+     <request-path>index*</request-path>
      <class>ToyTool</class>
   </tool>
   <data type="number">
     <key>version</key>
-    <value>1.1</value>
+    <value>1.2</value>
   </data>
   <data type="boolean">
     <key>isSimple</key>

Added: velocity/tools/branches/2.x/examples/simple/index.jsp
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/examples/simple/index.jsp?view=auto&rev=547128
==============================================================================
--- velocity/tools/branches/2.x/examples/simple/index.jsp (added)
+++ velocity/tools/branches/2.x/examples/simple/index.jsp Wed Jun 13 22:36:39 2007
@@ -0,0 +1,52 @@
+<%@taglib prefix="velocity" uri="http://velocity.apache.org/velocity-view" %>
+<html>
+<body>
+
+I'm a JSP file that uses the VelocityViewTag.
+
+<velocity:view>
+#if( $XHTML )
+  #set( $br = "<br />" )
+#else
+  #set( $br = "<br>" )
+#end
+
+$br
+$br
+
+Here we use a custom tool: $toytool.message
+
+$br
+$br
+
+Lets count : #foreach($i in [1..5])$i #end
+
+$br
+$br
+
+Let's play with a hashmap:$br
+first add foo: $map.put("foo",$foo)$br
+then add bar: $map.put("bar",$bar)$br
+$br
+and that gives us $map
+
+$br
+$br
+
+Here we get the date from the DateTool:  $date.medium
+
+$br
+$br
+
+#if( $isSimple )
+This is simple#if( $XHTML ) xhtml#end app version ${version}.
+#end
+
+$br
+$br
+
+Click <a href="index.vm">here</a> to see this VTL markup as a normal template.
+
+</velocity:view>
+</body>
+</html>

Propchange: velocity/tools/branches/2.x/examples/simple/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: velocity/tools/branches/2.x/examples/simple/index.vm
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/examples/simple/index.vm?view=diff&rev=547128&r1=547127&r2=547128
==============================================================================
--- velocity/tools/branches/2.x/examples/simple/index.vm (original)
+++ velocity/tools/branches/2.x/examples/simple/index.vm Wed Jun 13 22:36:39 2007
@@ -18,7 +18,7 @@
 <html>
 <body>
 
-I'm a velocity template.
+I'm a velocity template processed using the VelocityViewServlet.
 
 #if( $XHTML )
   #set( $br = "<br />" )
@@ -56,6 +56,11 @@
 #if( $isSimple )
 This is simple#if( $XHTML ) xhtml#end app version ${version}.
 #end
+
+$br
+$br
+
+Click <a href="index.jsp">here</a> to see the VelocityViewTag handle the same
VTL markup.
 
 </body>
 </html>



Mime
View raw message