Tutorial introduction

In this section, we will discover how to build a simple page containing a form, two input fields and a list. This page will allow the user to find people living in a specified city and having a specified name.

Here is a screenshot of the page:

And here is the code (19 lines, no HTML tags)

<layout:html>
	<layout:form action="myAction" styleClass="FORM">
		<layout:row>
			<layout:column>
				<layout:text key="search.name" property="name" styleClass="FIELD"/>
				<layout:text key="search.town" property="town" styleClass="FIELD"/>
				<layout:submit>
					<layout:message key="search.submit"/>
				</layout:submit>
			</layout:column>
			<layout:collection name="list" styleClass="ARRAY">
				<layout:collectionItem title="person.firstname" property="firstname"/>
				<layout:collectionItem title="person.lastname" property="lastname"/>
				<layout:collectionItem title="person.street" property="street"/>
				<layout:collectionItem title="person.town" property="town"/>
			</layout:collection>
		</layout:row>
	</layout:form>
</layout:html>

Now, let's have a first look at the struts-layout tags.

step 1: displaying the input fields