1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<%@ page language="java" %>
3
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
4
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
5
<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el" %>
6
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
9
<title>Test struts logic-el Match Tags</title>
11
<body bgcolor="white">
14
<h1>Test struts logic-el Match Tags</h1>
17
<jsp:useBean id="bean" scope="page" class="org.apache.struts.webapp.exercise.TestBean"/>
18
<c:set var="jcookie" value='${cookie["JSESSIONID"].value}'/>
19
<c:set var="uaheader" value='${header["User-Agent"]}'/>
20
<c:set var="rparam" value='${param["param1"]}'/>
22
pageContext.setAttribute("string", "String test value");
28
<th>Variable Content</th>
29
<th>Value Content</th>
30
<th>Correct Value Test</th>
35
<%-- This isn't an exact parallel. With "bean:cookie", you can specify a
36
default value. That would take another step with this. --%>
37
<td><c:out value="${jcookie}"/></td>
42
<c:when test="${not empty jcookie}">
43
<%-- The functionality of "logic:match" will eventually be available
44
through a string function in the EL expression. --%>
45
<logic-el:match expr="${jcookie}" value="0">
48
<logic-el:notMatch expr="${jcookie}" value="0">
60
<td><c:out value="${jcookie}"/></td>
65
<c:when test="${not empty jcookie}">
66
<logic-el:match expr="${jcookie}" location="end" value="0">
69
<logic-el:notMatch expr="${jcookie}" location="end" value="0">
80
<td>Cookie / Start</td>
81
<td><c:out value="${jcookie}"/></td>
86
<c:when test="${not empty jcookie}">
87
<logic-el:match expr="${jcookie}" location="start" value="0">
90
<logic-el:notMatch expr="${jcookie}" location="start" value="0">
101
<td>Header / Any</td>
102
<td><c:out value="${uaheader}"/></td>
107
<c:when test="${not empty uaheader}">
108
<logic-el:match expr="${uaheader}" value="Mozilla">
111
<logic-el:notMatch expr="${uaheader}" value="Mozilla">
122
<td>Header / End</td>
123
<td><c:out value="${uaheader}"/></td>
128
<c:when test="${not empty uaheader}">
129
<logic-el:match expr="${uaheader}" location="end" value="Mozilla">
132
<logic-el:notMatch expr="${uaheader}" location="end" value="Mozilla">
143
<td>Header / Start</td>
144
<td><c:out value="${uaheader}"/></td>
149
<c:when test="${not empty uaheader}">
150
<logic-el:match expr="${uaheader}" location="start" value="Mozilla">
153
<logic-el:notMatch expr="${uaheader}" location="start" value="Mozilla">
165
<td><c:out value="${string}"/></td>
169
<logic-el:match name="string" value="value">
172
<logic-el:notMatch name="string" value="value">
179
<td><c:out value="${string}"/></td>
183
<logic-el:match name="string" location="end" value="value">
186
<logic-el:notMatch name="string" location="end" value="value">
192
<td>Name / Start</td>
193
<td><c:out value="${string}"/></td>
197
<logic-el:match name="string" location="start" value="value">
200
<logic-el:notMatch name="string" location="start" value="value">
206
<td>Parameter / Any</td>
207
<td><c:out value="${rparam}"/></td>
212
<c:when test="${not empty rparam}">
213
<logic-el:match expr="${rparam}" value="value1">
216
<logic-el:notMatch expr="${rparam}" value="value1">
227
<td>Parameter / End</td>
228
<td><c:out value="${rparam}"/></td>
233
<c:when test="${not empty rparam}">
234
<logic-el:match expr="${rparam}" location="end" value="value1">
237
<logic-el:notMatch expr="${rparam}" location="end" value="value1">
248
<td>Parameter / Start</td>
249
<td><c:out value="${rparam}"/></td>
254
<c:when test="${not empty rparam}">
255
<logic-el:match expr="${rparam}" location="start" value="value1">
258
<logic-el:notMatch expr="${rparam}" location="start" value="value1">
269
<td>Property / Any</td>
270
<td><c:out value="${bean.stringProperty}"/></td>
274
<logic-el:match expr="${bean.stringProperty}" value="FOO">
277
<logic-el:notMatch expr="${bean.stringProperty}" value="FOO">
283
<td>Property / End</td>
284
<td><c:out value="${bean.stringProperty}"/></td>
288
<logic-el:match expr="${bean.stringProperty}" location="end" value="FOO">
291
<logic-el:notMatch expr="${bean.stringProperty}"
292
location="end" value="FOO">
298
<td>Property / Start</td>
299
<td><c:out value="${bean.stringProperty}"/></td>
303
<logic-el:match expr="${bean.stringProperty}"
304
location="start" value="FOO">
307
<logic-el:notMatch expr="${bean.stringProperty}"
308
location="start" value="FOO">