<%-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --%> <%@ page language="java" contentType="text/html; charset=UTF-8" %> <%@ page import="org.apache.struts.action.ActionErrors" %> <%@ page import="org.apache.struts.action.ActionMessages" %> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> Logic Tags Example View Source Return to examples page

Logic Tags Example


Present / Not Present

Cookie

Session cookie is present.

UNKNOWN cookie is not present.

Parameter

Parameter 'param' not present. Redisplay page with parameter present.

Bean

'testBean' is present.

'anotherTestBean' is not present.

'fred' property is present on 'testBean'

'fred' property is not present on 'testBean'

'stringValue' property is present on 'testBean'

Empty / Not Empty

'items' was found.

'items' is empty

'items' is not empty

<%--

Items has items.

--%>

Comparison tags

intValue == 7

intValue >= 7

intValue >= 6

intValue > 6

intValue <= 7

intValue <= 8

intValue < 8

stringValue matches 'world'

stringValue does not match 'earth'

stringValue does not match 'world'

Iteration

Book list:

Book list (entries 3-5):

Checking for and displaying messages

Errors:

Global errors:

Errors for 'test':

There are no errors

Messages:

Messages for 'test':

There are no messages