A Techno Blog, mainly about Java


View – renders the content of the model – access data from model and decide how to present it – forward user input to controller.

Tiles provides a framework for defining and dynamically populating page layouts.

The JSP file will define a template with placeholders where the content should go.

When the JSP file is invoked, it replaces the place holders with content creating a page
which is an instance of the layout.

Enabling the Tiles plugin:
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property value="/WEB-INF/tiles-defs.xml" property="definitions-config" />
     <set-property value="0" property="definitions-debug" />
     <set-property value="0" property="definitions-parser-details" />
     <set-property value="false" property="definitions-parser-validate" />


A Tiles definition specifies the layout for a piece of content.

Tiles can insert into a JSP using the definition name which consists of:

  • name or identifier
  • set of attributes associated with the definition
  • a layout JSP name (instance file name of the given definition and attributes)

Using the Tiles Tag libray in JSP file:

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert> –  Inserts a tiles definition or attribute into a JSP page.
   Note: the attribute ‘template’ is deprecated (1.2)
         It is replaced by the attribute ‘page’ .
                 <tiles:insert template="/templates/Header.jsp" >

<tiles:put>    –  Defines an attribute (or parameter) for a definition.
   Note: the attribute ‘name’ specifies the name of the attribute
          <tiles:put name="page_title" direct="true">
          <bean:message key="head.title.prefix"/>
          <bean:message key="title.profile.create1"/>

Using the Bean Tag libray in JSP file:

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<bean:define>    –  Defines a variable to be associated with a bean property
          <bean:define  id="codeText" name="securityListForm"
                              type="java.lang.String" property="code"
<bean:message>    –  Display a text replacement string associated with an identifier (prop file)
          <bean:message key="head.title.prefix"/>
<bean:write>    –  Display a bean properties value (name can be bean name or bean variable defined for jsp)

           <bean:write name="CodeListForm" property="code" />

Using the logic Tag libray in JSP file:

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<logic:iterate>    –  Iterate over a list

<logic:iterate id="codes"              indexId="index"
                  name="securityListForm" property="list"



<logic:greaterThan>    –  execute logic if condition met

                 <bean:size id="listSize" name="listForm" property="list"/>
                 <logic:greaterThan name="listSize" value="0">


<logic:equal>    –  execute logic if condition met

              <logic:equal name="securityListForm" property="tabNumber" value="20">

Using the HTML Tag libray in JSP file:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html:form>    –  form definition

<html:text >







Not Empty Tag

May 18, 2005 - Posted by | Struts

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: