You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/09/07 03:36:37 UTC
cvs commit: jakarta-struts/web/test logic-compare.jsp logic-iterate.jsp logic-match.jsp logic-present.jsp index.jsp
craigmcc 00/09/06 18:36:36
Modified: web/test index.jsp
Added: web/test logic-compare.jsp logic-iterate.jsp logic-match.jsp
logic-present.jsp
Log:
Enhance the test application to include tests for the new "logic library"
custom tags.
Revision Changes Path
1.2 +15 -7 jakarta-struts/web/test/index.jsp
Index: index.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/web/test/index.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.jsp 2000/09/05 21:28:05 1.1
+++ index.jsp 2000/09/07 01:36:36 1.2
@@ -10,13 +10,21 @@
<h3>BEAN Tags</h3>
<ul>
-<li><a href="bean-cookie.jsp"><struts-bean:cookie></a>
-<li><a href="bean-define.jsp"><struts-bean:define></a>
-<li><a href="bean-header.jsp"><struts-bean:header></a>
-<li><a href="bean-include.jsp"><struts-bean:include></a>
-<li><a href="bean-parameter.jsp?param1=value1¶m2=value2"><struts-bean:parameter></a>
-<li><a href="bean-resource.jsp"><struts-bean:resource></a>
-<li><a href="bean-write.jsp"><struts-bean:write></a>
+<li><a href="bean-cookie.jsp"><struts-bean:cookie></a></li>
+<li><a href="bean-define.jsp"><struts-bean:define></a></li>
+<li><a href="bean-header.jsp"><struts-bean:header></a></li>
+<li><a href="bean-include.jsp"><struts-bean:include></a></li>
+<li><a href="bean-parameter.jsp?param1=value1¶m2=value2"><struts-bean:parameter></a></li>
+<li><a href="bean-resource.jsp"><struts-bean:resource></a></li>
+<li><a href="bean-write.jsp"><struts-bean:write></a></li>
+</ul>
+
+<h3>LOGIC Tags</h3>
+<ul>
+<li><a href="logic-compare.jsp">Comparison Tags</a></li>
+<li><a href="logic-iterate.jsp">Iterate Tag</a></li>
+<li><a href="logic-match.jsp?param1=value1">Match Tags</a></li>
+<li><a href="logic-present.jsp?param1=value1">Presence Tags</a></li>
</ul>
</body>
1.1 jakarta-struts/web/test/logic-compare.jsp
Index: logic-compare.jsp
===================================================================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>Test struts-logic Comparison Tags</title>
</head>
<body bgcolor="white">
<div align="center">
<h1>Test struts-logic Comparison Tags</h1>
</div>
<jsp:useBean id="bean" scope="page" class="org.apache.struts.test.TestBean"/>
<%
String doub1 = "321.0";
String doub2 = "111.0";
String doub3 = "333.0";
String long1 = "321";
String long2 = "111";
String long3 = "333";
String str1 = "This is a string";
String str2 = "Less than";
String str3 = "XYZ greater than";
%>
<table border="1">
<tr>
<th>Test Type</th>
<th>Variable Content</th>
<th>Value Content </th>
<th>Correct Value</th>
<th>Test Result</th>
</tr>
<tr>
<td>double / EQ</td>
<td><bean:write name="bean" property="doubleProperty"/></td>
<td><%= doub1 %></td>
<td>equal greaterEqual lessEqual</td>
<td>
<logic:equal name="bean" property="doubleProperty"
value="<%= doub1 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="doubleProperty"
value="<%= doub1 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="doubleProperty"
value="<%= doub1 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="doubleProperty"
value="<%= doub1 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="doubleProperty"
value="<%= doub1 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="doubleProperty"
value="<%= doub1 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>double / GT</td>
<td><bean:write name="bean" property="doubleProperty"/></td>
<td><%= doub2 %></td>
<td>greaterEqual greaterThan notEqual</td>
<td>
<logic:equal name="bean" property="doubleProperty"
value="<%= doub2 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="doubleProperty"
value="<%= doub2 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="doubleProperty"
value="<%= doub2 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="doubleProperty"
value="<%= doub2 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="doubleProperty"
value="<%= doub2 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="doubleProperty"
value="<%= doub2 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>double / LT</td>
<td><bean:write name="bean" property="doubleProperty"/></td>
<td><%= doub3 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="doubleProperty"
value="<%= doub3 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="doubleProperty"
value="<%= doub3 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="doubleProperty"
value="<%= doub3 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="doubleProperty"
value="<%= doub3 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="doubleProperty"
value="<%= doub3 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="doubleProperty"
value="<%= doub3 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>float / EQ</td>
<td><bean:write name="bean" property="floatProperty"/></td>
<td><%= doub1 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="floatProperty"
value="<%= doub1 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="floatProperty"
value="<%= doub1 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="floatProperty"
value="<%= doub1 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="floatProperty"
value="<%= doub1 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="floatProperty"
value="<%= doub1 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="floatProperty"
value="<%= doub1 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>float / GT</td>
<td><bean:write name="bean" property="floatProperty"/></td>
<td><%= doub2 %></td>
<td>greaterEqual greaterThan notEqual</td>
<td>
<logic:equal name="bean" property="floatProperty"
value="<%= doub2 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="floatProperty"
value="<%= doub2 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="floatProperty"
value="<%= doub2 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="floatProperty"
value="<%= doub2 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="floatProperty"
value="<%= doub2 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="floatProperty"
value="<%= doub2 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>float / LT</td>
<td><bean:write name="bean" property="floatProperty"/></td>
<td><%= doub3 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="floatProperty"
value="<%= doub3 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="floatProperty"
value="<%= doub3 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="floatProperty"
value="<%= doub3 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="floatProperty"
value="<%= doub3 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="floatProperty"
value="<%= doub3 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="floatProperty"
value="<%= doub3 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>long / EQ</td>
<td><bean:write name="bean" property="longProperty"/></td>
<td><%= long1 %></td>
<td>equal greaterEqual lessEqual</td>
<td>
<logic:equal name="bean" property="longProperty"
value="<%= long1 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="longProperty"
value="<%= long1 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="longProperty"
value="<%= long1 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="longProperty"
value="<%= long1 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="longProperty"
value="<%= long1 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="longProperty"
value="<%= long1 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>long / GT</td>
<td><bean:write name="bean" property="longProperty"/></td>
<td><%= long2 %></td>
<td>greaterEqual greaterThan notEqual</td>
<td>
<logic:equal name="bean" property="longProperty"
value="<%= long2 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="longProperty"
value="<%= long2 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="longProperty"
value="<%= long2 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="longProperty"
value="<%= long2 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="longProperty"
value="<%= long2 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="longProperty"
value="<%= long2 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>long / LT</td>
<td><bean:write name="bean" property="longProperty"/></td>
<td><%= long3 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="longProperty"
value="<%= long3 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="longProperty"
value="<%= long3 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="longProperty"
value="<%= long3 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="longProperty"
value="<%= long3 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="longProperty"
value="<%= long3 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="longProperty"
value="<%= long3 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>int / EQ</td>
<td><bean:write name="bean" property="intProperty"/></td>
<td><%= long1 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="intProperty"
value="<%= long1 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="intProperty"
value="<%= long1 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="intProperty"
value="<%= long1 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="intProperty"
value="<%= long1 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="intProperty"
value="<%= long1 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="intProperty"
value="<%= long1 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>int / GT</td>
<td><bean:write name="bean" property="intProperty"/></td>
<td><%= long2 %></td>
<td>greaterEqual greaterThan notEqual</td>
<td>
<logic:equal name="bean" property="intProperty"
value="<%= long2 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="intProperty"
value="<%= long2 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="intProperty"
value="<%= long2 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="intProperty"
value="<%= long2 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="intProperty"
value="<%= long2 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="intProperty"
value="<%= long2 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>int / LT</td>
<td><bean:write name="bean" property="intProperty"/></td>
<td><%= long3 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="intProperty"
value="<%= long3 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="intProperty"
value="<%= long3 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="intProperty"
value="<%= long3 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="intProperty"
value="<%= long3 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="intProperty"
value="<%= long3 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="intProperty"
value="<%= long3 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>string / EQ</td>
<td><bean:write name="bean" property="stringProperty"/></td>
<td><%= str1 %></td>
<td>equal greaterEqual lessEqual</td>
<td>
<logic:equal name="bean" property="stringProperty"
value="<%= str1 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="stringProperty"
value="<%= str1 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="stringProperty"
value="<%= str1 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="stringProperty"
value="<%= str1 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="stringProperty"
value="<%= str1 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="stringProperty"
value="<%= str1 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>string / GT</td>
<td><bean:write name="bean" property="stringProperty"/></td>
<td><%= str2 %></td>
<td>greaterEqual greaterThan notEqual</td>
<td>
<logic:equal name="bean" property="stringProperty"
value="<%= str2 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="stringProperty"
value="<%= str2 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="stringProperty"
value="<%= str2 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="stringProperty"
value="<%= str2 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="stringProperty"
value="<%= str2 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="stringProperty"
value="<%= str2 %>">
notEqual
</logic:notEqual>
</td>
</tr>
<tr>
<td>string / LT</td>
<td><bean:write name="bean" property="stringProperty"/></td>
<td><%= str3 %></td>
<td>lessEqual lessThan notEqual</td>
<td>
<logic:equal name="bean" property="stringProperty"
value="<%= str3 %>">
equal
</logic:equal>
<logic:greaterEqual name="bean" property="stringProperty"
value="<%= str3 %>">
greaterEqual
</logic:greaterEqual>
<logic:greaterThan name="bean" property="stringProperty"
value="<%= str3 %>">
greaterThan
</logic:greaterThan>
<logic:lessEqual name="bean" property="stringProperty"
value="<%= str3 %>">
lessEqual
</logic:lessEqual>
<logic:lessThan name="bean" property="stringProperty"
value="<%= str3 %>">
lessThan
</logic:lessThan>
<logic:notEqual name="bean" property="stringProperty"
value="<%= str3 %>">
notEqual
</logic:notEqual>
</td>
</tr>
</table>
</body>
</html>
1.1 jakarta-struts/web/test/logic-iterate.jsp
Index: logic-iterate.jsp
===================================================================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>Test struts-logic Iterate Tag</title>
</head>
<body bgcolor="white">
<div align="center">
<h1>Test struts-logic Iterate Tag</h1>
</div>
<jsp:useBean id="bean" scope="page" class="org.apache.struts.test.TestBean"/>
<h3>Test 1 - Iterate Over A String Array [0..4]</h3>
<ol>
<logic:iterate id="element" name="bean" property="stringArray">
<li><em><bean:write name="element"/></em></li>
</logic:iterate>
</ol>
<h3>Test 2 - Iterate Over A String Array [0..2]</h3>
<ol>
<logic:iterate id="element" name="bean" property="stringArray" length="3">
<li><em><bean:write name="element"/></em></li>
</logic:iterate>
</ol>
<h3>Test 3 - Iterate Over A String Array [3..4]</h3>
<ol>
<logic:iterate id="element" name="bean" property="stringArray" offset="3">
<li><em><bean:write name="element"/></em></li>
</logic:iterate>
</ol>
<h3>Test 4 - Iterate Over A String Array [1..3]</h3>
<ol>
<logic:iterate id="element" name="bean" property="stringArray"
offset="1" length="3">
<li><em><bean:write name="element"/></em></li>
</logic:iterate>
</ol>
</body>
</html>
1.1 jakarta-struts/web/test/logic-match.jsp
Index: logic-match.jsp
===================================================================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>Test struts-logic Match Tags</title>
</head>
<body bgcolor="white">
<div align="center">
<h1>Test struts-logic Match Tags</h1>
</div>
<jsp:useBean id="bean" scope="page" class="org.apache.struts.test.TestBean"/>
<bean:cookie id="cookie" name="JSESSIONID"/>
<bean:header id="header" name="user-agent"/>
<bean:parameter id="param" name="param1"/>
<%
pageContext.setAttribute("string", "String test value");
%>
<table border="1">
<tr>
<th>Test Type</th>
<th>Variable Content</th>
<th>Value Content</th>
<th>Correct Value Test</th>
<th>Test Result</th>
</tr>
<tr>
<td>Cookie / Any</td>
<td><bean:write name="cookie" property="value"/></td>
<td>0</td>
<td>contains</td>
<td>
<logic:match cookie="JSESSIONID" value="0">
match
</logic:match>
<logic:notMatch cookie="JSESSIONID" value="0">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Cookie / End</td>
<td><bean:write name="cookie" property="value"/></td>
<td>0</td>
<td>ends with</td>
<td>
<logic:match cookie="JSESSIONID" location="end" value="0">
match
</logic:match>
<logic:notMatch cookie="JSESSIONID" location="end" value="0">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Cookie / Start</td>
<td><bean:write name="cookie" property="value"/></td>
<td>0</td>
<td>starts with</td>
<td>
<logic:match cookie="JSESSIONID" location="start" value="0">
match
</logic:match>
<logic:notMatch cookie="JSESSIONID" location="start" value="0">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Header / Any</td>
<td><bean:write name="header"/></td>
<td>Mozilla</td>
<td>contains</td>
<td>
<logic:match header="user-agent" value="Mozilla">
match
</logic:match>
<logic:notMatch header="user-agent" value="Mozilla">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Header / End</td>
<td><bean:write name="header"/></td>
<td>Mozilla</td>
<td>ends with</td>
<td>
<logic:match header="user-agent" location="end" value="Mozilla">
match
</logic:match>
<logic:notMatch header="user-agent" location="end" value="Mozilla">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Header / Start</td>
<td><bean:write name="header"/></td>
<td>Mozilla</td>
<td>starts with</td>
<td>
<logic:match header="user-agent" location="start" value="Mozilla">
match
</logic:match>
<logic:notMatch header="user-agent" location="start" value="Mozilla">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Name / Any</td>
<td><bean:write name="string"/></td>
<td>value</td>
<td>contains</td>
<td>
<logic:match name="string" value="value">
match
</logic:match>
<logic:notMatch name="string" value="value">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Name / End</td>
<td><bean:write name="string"/></td>
<td>value</td>
<td>ends with</td>
<td>
<logic:match name="string" location="end" value="value">
match
</logic:match>
<logic:notMatch name="string" location="end" value="value">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Name / Start</td>
<td><bean:write name="string"/></td>
<td>value</td>
<td>starts with</td>
<td>
<logic:match name="string" location="start" value="value">
match
</logic:match>
<logic:notMatch name="string" location="start" value="value">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Parameter / Any</td>
<td><bean:write name="param"/></td>
<td>value1</td>
<td>contains</td>
<td>
<logic:match parameter="param1" value="value1">
match
</logic:match>
<logic:notMatch parameter="param1" value="value1">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Parameter / End</td>
<td><bean:write name="param"/></td>
<td>value1</td>
<td>ends with</td>
<td>
<logic:match parameter="param1" location="end" value="value1">
match
</logic:match>
<logic:notMatch parameter="param1" location="end" value="value1">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Parameter / Start</td>
<td><bean:write name="param"/></td>
<td>value1</td>
<td>starts with</td>
<td>
<logic:match parameter="param1" location="start" value="value1">
match
</logic:match>
<logic:notMatch parameter="param1" location="start" value="value1">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Property / Any</td>
<td><bean:write name="bean" property="stringProperty"/></td>
<td>FOO</td>
<td>contains</td>
<td>
<logic:match name="bean" property="stringProperty" value="FOO">
match
</logic:match>
<logic:notMatch name="bean" property="stringProperty" value="FOO">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Property / End</td>
<td><bean:write name="bean" property="stringProperty"/></td>
<td>FOO</td>
<td>ends with</td>
<td>
<logic:match name="bean" property="stringProperty"
location="end" value="FOO">
match
</logic:match>
<logic:notMatch name="bean" property="stringProperty"
location="end" value="FOO">
notMatch
</logic:notMatch>
</td>
</tr>
<tr>
<td>Property / Start</td>
<td><bean:write name="bean" property="stringProperty"/></td>
<td>FOO</td>
<td>starts with</td>
<td>
<logic:match name="bean" property="stringProperty"
location="start" value="FOO">
match
</logic:match>
<logic:notMatch name="bean" property="stringProperty"
location="start" value="FOO">
notMatch
</logic:notMatch>
</td>
</tr>
</table>
</body>
</html>
1.1 jakarta-struts/web/test/logic-present.jsp
Index: logic-present.jsp
===================================================================
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>Test struts-logic Presence Tags</title>
</head>
<body bgcolor="white">
<div align="center">
<h1>Test struts-logic Presence Tags</h1>
</div>
<jsp:useBean id="bean" scope="page" class="org.apache.struts.test.TestBean"/>
<table border="1">
<tr>
<th>Test Type</th>
<th>Correct Value</th>
<th>Test Result</th>
</tr>
<tr>
<td>Bean</td>
<td>present</td>
<td>
<logic:present name="bean">
present
</logic:present>
<logic:notPresent name="bean">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Bean</td>
<td>notPresent</td>
<td>
<logic:present name="FOOBAR">
present
</logic:present>
<logic:notPresent name="FOOBAR">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Cookie</td>
<td>present</td>
<td>
<logic:present cookie="JSESSIONID">
present
</logic:present>
<logic:notPresent cookie="JSESSIONID">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Cookie</td>
<td>notPresent</td>
<td>
<logic:present cookie="FOOBAR">
present
</logic:present>
<logic:notPresent cookie="FOOBAR">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Header</td>
<td>present</td>
<td>
<logic:present header="user-agent">
present
</logic:present>
<logic:notPresent header="user-agent">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Header</td>
<td>notPresent</td>
<td>
<logic:present header="FOOBAR">
present
</logic:present>
<logic:notPresent header="FOOBAR">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Parameter</td>
<td>present</td>
<td>
<logic:present parameter="param1">
present
</logic:present>
<logic:notPresent parameter="param1">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Parameter</td>
<td>notPresent</td>
<td>
<logic:present parameter="FOOBAR">
present
</logic:present>
<logic:notPresent parameter="FOOBAR">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Property</td>
<td>present</td>
<td>
<logic:present name="bean" property="stringProperty">
present
</logic:present>
<logic:notPresent name="bean" property="stringProperty">
notPresent
</logic:notPresent>
</td>
</tr>
<tr>
<td>Property</td>
<td>notPresent</td>
<td>
<logic:present name="bean" property="nullProperty">
present
</logic:present>
<logic:notPresent name="bean" property="nullProperty">
notPresent
</logic:notPresent>
</td>
</tr>
</table>
</body>
</html>