Commits

tmjee  committed 495b4ec

- added test example to showcase (to test the If/Else/ElseIf tag in both freemarker and jsp form)

Issue number: WW-1328
Obtained from:
Submitted by:
Reviewed by:

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

  • Participants
  • Parent commits 12847c5

Comments (0)

Files changed (4)

File webapps/showcase/src/webapp/WEB-INF/classes/xwork-tags-non-ui.xml

 		</action>
 	</package>
 	
+	<!--  ============================================ -->
+	<!--  === Package for IfTag demo / testing     === -->
+	<!--  ============================================ -->
+	<package name="ifTag" extends="webwork-default" namespace="/tags/non-ui/ifTag">
+		<action name="testIfTagJsp">
+			<result>/tags/non-ui/ifTag/testIf.jsp</result>
+		</action>
+		<action name="testIfTagFreemarker">
+			<result type="freemarker">/tags/non-ui/ifTag/testIf.ftl</result>
+		</action>	
+	</package>
 	
 	
 </xwork>

File webapps/showcase/src/webapp/tags/non-ui/ifTag/testIf.ftl

+<html>
+<head>
+	<title></title>
+</head>
+<body>
+	
+<!--  1 -->
+<@ww.if test="true">
+	1]THIS SHOULD APPEAR <br/>
+</@ww.if>
+<@ww.else>
+	THIS SHOULD NOT APPEAR <br/>
+</@ww.else>
+
+
+<!--  2 -->
+<@ww.if test="false">
+	THIS SHOULD NOT APPEAR <br/>
+</@ww.if>
+<@ww.elseif test="true">
+	2]THIS SHOULD APPEAR <br/>
+</@ww.elseif>
+
+<!--  3 -->
+<@ww.if test="false">
+	THIS SHOULD NOT APPEAR <br/>
+</@ww.if>
+<@ww.elseif test="false">
+	THIS SHOULD NOT APPEAR <br/>
+</@ww.elseif>
+<@ww.elseif test="true">
+	3]THIS SHOULD APPEAR <br/>
+</@ww.elseif>
+<@ww.elseif test="true">
+	THIS SHOULD NOT APPEAR <br/>
+</@ww.elseif>
+<@ww.else>
+	THIS SHOULD NOT APPEAR <br/>
+</@ww.else>
+
+<!-- 4 -->
+<@ww.if test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</@ww.if>
+<@ww.elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</@ww.elseif>
+<@ww.else>
+	4]THIS SHOULD APPEAR<br/>
+</@ww.else>
+
+<!-- 5 -->
+<@ww.if test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</@ww.if>
+<@ww.elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</@ww.elseif>
+<@ww.elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</@ww.elseif>
+<@ww.elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</@ww.elseif>
+<@ww.else>
+	5]THIS SHOULD APPEAR<br/>
+</@ww.else>
+	
+	
+</body>
+</html>

File webapps/showcase/src/webapp/tags/non-ui/ifTag/testIf.jsp

+<%@ page language="java" contentType="text/html; charset=UTF-8"
+    pageEncoding="UTF-8"%>
+
+<%@taglib prefix="ww" uri="/webwork" %>    
+    
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Insert title here</title>
+</head>
+<body>
+<!--  1 -->
+<ww:if test="true">
+	1]THIS SHOULD APPEAR <br/>
+</ww:if>
+<ww:else>
+	THIS SHOULD NOT APPEAR <br/>
+</ww:else>
+
+
+<!--  2 -->
+<ww:if test="false">
+	THIS SHOULD NOT APPEAR <br/>
+</ww:if>
+<ww:elseif test="true">
+	2]THIS SHOULD APPEAR <br/>
+</ww:elseif>
+
+<!--  3 -->
+<ww:if test="false">
+	THIS SHOULD NOT APPEAR <br/>
+</ww:if>
+<ww:elseif test="false">
+	THIS SHOULD NOT APPEAR <br/>
+</ww:elseif>
+<ww:elseif test="true">
+	3]THIS SHOULD APPEAR <br/>
+</ww:elseif>
+<ww:elseif test="true">
+	THIS SHOULD NOT APPEAR <br/>
+</ww:elseif>
+<ww:else>
+	THIS SHOULD NOT APPEAR <br/>
+</ww:else>
+
+<!-- 4 -->
+<ww:if test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</ww:if>
+<ww:elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</ww:elseif>
+<ww:else>
+	4]THIS SHOULD APPEAR<br/>
+</ww:else>
+
+<!-- 5 -->
+<ww:if test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</ww:if>
+<ww:elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</ww:elseif>
+<ww:elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</ww:elseif>
+<ww:elseif test="false">
+	THIS SHOULD NOT APPEAR<br/>
+</ww:elseif>
+<ww:else>
+	5]THIS SHOULD APPEAR<br/>
+</ww:else>
+
+
+</body>
+</html>

File webapps/showcase/src/webapp/tags/non-ui/index.jsp

 	<li><ww:url id="url" action="showAppendTagDemo" namespace="/tags/non-ui/appendIteratorTag" /><ww:a href="%{#url}">Append Iterator Tag</ww:a>
 	<li><ww:url id="url" action="showMergeTagDemo" namespace="/tags/non-ui/mergeIteratorTag" /><ww:a href="%{#url}">Merge Iterator Demo</ww:a>
 	<li><ww:url id="url" action="showSubsetTagDemo" namespace="/tags/non-ui/subsetIteratorTag" /><ww:a href="%{#url}">Subset Tag</ww:a>
+	<li><ww:url id="url" action="testIfTagFreemarker" namespace="/tags/non-ui/ifTag" /><ww:a href="%{#url}">If Tag (freemarker)</ww:a></li>
+	<li><ww:url id="url" action="testIfTagJsp" namespace="/tags/non-ui/ifTag" /><ww:a href="%{#url}">If Tag (JSP)</ww:a></li>
 </ul>
 
 </body>