<%@ 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