1
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
2
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
5
<title>Test struts-logic Match Tags</title>
9
<h1>Test struts-logic Match Tags</h1>
11
<jsp:useBean id="bean" scope="page" class="org.apache.struts.webapp.exercise.TestBean" />
12
<bean:cookie id="cookie" name="JSESSIONID" value="JSESSIONID-IS-UNDEFINED" />
13
<bean:header id="header" name="User-Agent" value="USER-AGENT-IS-UNDEFINED" />
14
<bean:parameter id="param" name="param1" value="PARAMETER-IS-UNDEFINED" /><%
15
pageContext.setAttribute("string", "String test value");
20
<th>Variable Content</th>
21
<th>Value Content</th>
22
<th>Correct Value Test</th>
28
<bean:write name="cookie" property="value" />
33
<logic:present cookie="JSESSIONID">
34
<logic:match cookie="JSESSIONID" value="0">match</logic:match>
35
<logic:notMatch cookie="JSESSIONID" value="0">notMatch</logic:notMatch>
37
<logic:notPresent cookie="JSESSIONID">missing</logic:notPresent>
43
<bean:write name="cookie" property="value" />
48
<logic:present cookie="JSESSIONID">
49
<logic:match cookie="JSESSIONID" location="end" value="0">match</logic:match>
50
<logic:notMatch cookie="JSESSIONID" location="end" value="0">notMatch</logic:notMatch>
52
<logic:notPresent cookie="JSESSIONID">missing</logic:notPresent>
56
<td>Cookie / Start</td>
58
<bean:write name="cookie" property="value" />
63
<logic:present cookie="JSESSIONID">
64
<logic:match cookie="JSESSIONID" location="start" value="0">match</logic:match>
65
<logic:notMatch cookie="JSESSIONID" location="start" value="0">notMatch</logic:notMatch>
67
<logic:notPresent cookie="JSESSIONID">missing</logic:notPresent>
73
<bean:write name="header" />
78
<logic:present header="User-Agent">
79
<logic:match header="User-Agent" value="Mozilla">match</logic:match>
80
<logic:notMatch header="User-Agent" value="Mozilla">notMatch</logic:notMatch>
82
<logic:notPresent header="User-Agent">missing</logic:notPresent>
88
<bean:write name="header" />
93
<logic:present header="User-Agent">
94
<logic:match header="User-Agent" location="end" value="Mozilla">match</logic:match>
95
<logic:notMatch header="User-Agent" location="end" value="Mozilla">notMatch</logic:notMatch>
97
<logic:notPresent header="User-Agent">missing</logic:notPresent>
101
<td>Header / Start</td>
103
<bean:write name="header" />
108
<logic:present header="User-Agent">
109
<logic:match header="User-Agent" location="start" value="Mozilla">match</logic:match>
110
<logic:notMatch header="User-Agent" location="start" value="Mozilla">notMatch</logic:notMatch>
112
<logic:notPresent header="User-Agent">missing</logic:notPresent>
118
<bean:write name="string" />
123
<logic:match name="string" value="value">match</logic:match>
124
<logic:notMatch name="string" value="value">notMatch</logic:notMatch>
130
<bean:write name="string" />
135
<logic:match name="string" location="end" value="value">match</logic:match>
136
<logic:notMatch name="string" location="end" value="value">notMatch</logic:notMatch>
140
<td>Name / Start</td>
142
<bean:write name="string" />
147
<logic:match name="string" location="start" value="value">match</logic:match>
148
<logic:notMatch name="string" location="start" value="value">notMatch</logic:notMatch>
152
<td>Parameter / Any</td>
154
<bean:write name="param" />
159
<logic:present parameter="param1">
160
<logic:match parameter="param1" value="value1">match</logic:match>
161
<logic:notMatch parameter="param1" value="value1">notMatch</logic:notMatch>
163
<logic:notPresent parameter="param1">missing</logic:notPresent>
167
<td>Parameter / End</td>
169
<bean:write name="param" />
174
<logic:present parameter="param1">
175
<logic:match parameter="param1" location="end" value="value1">match</logic:match>
176
<logic:notMatch parameter="param1" location="end" value="value1">notMatch</logic:notMatch>
178
<logic:notPresent parameter="param1">missing</logic:notPresent>
182
<td>Parameter / Start</td>
184
<bean:write name="param" />
189
<logic:present parameter="param1">
190
<logic:match parameter="param1" location="start" value="value1">match</logic:match>
191
<logic:notMatch parameter="param1" location="start" value="value1">notMatch</logic:notMatch>
193
<logic:notPresent parameter="param1">missing</logic:notPresent>
197
<td>Property / Any</td>
199
<bean:write name="bean" property="stringProperty" />
204
<logic:match name="bean" property="stringProperty" value="FOO">match</logic:match>
205
<logic:notMatch name="bean" property="stringProperty" value="FOO">notMatch</logic:notMatch>
209
<td>Property / End</td>
211
<bean:write name="bean" property="stringProperty" />
216
<logic:match name="bean" property="stringProperty" location="end" value="FOO">match</logic:match>
217
<logic:notMatch name="bean" property="stringProperty" location="end" value="FOO">notMatch</logic:notMatch>
221
<td>Property / Start</td>
223
<bean:write name="bean" property="stringProperty" />
228
<logic:match name="bean" property="stringProperty" location="start" value="FOO">match</logic:match>
229
<logic:notMatch name="bean" property="stringProperty" location="start" value="FOO">notMatch</logic:notMatch>