1. Now we need to create the Results.jsp page
    1. From the main project expand the WebRoot tree, and open the Results.jsp page.
    2. Paste the following logic into it and save the page <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
      <%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
      <%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>

      <%@ page import="pdata.*" %>
      <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

      <%@ page isELIgnored ="false" %>

      <html:html>
      <body bgcolor="lightblue">
          <h3>My First Struts Application </h3>
          <ul>
              <li>${personalDataBean.firstname} </li>
              <li>${personalDataBean.lastname} </li>
              <li>${personalDataBean.address} </li>
              <li>${personalDataBean.city} </li>
              <li>${personalDataBean.state} </li>
          </ul> <br>
      </body>
      </html:html>
  2. Let's create the Error.jsp page
    1. From the main project expand the WebRoot tree, and open the Error.jsp page.
    2. Paste the following logic into it and save the file <%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
      <%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
      <%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>

      <html>
      <body>
          <h3>
              FAILURE
          </h3>
      </body>
      <html>
  3. Create a ApplicationResources.properties file by Right clicking on New => File, and name the file ApplicationResources.properties.
  4. Now we need to create a simple build file
    1. From the main project select the ant folder, and add a new file.
    2. Right click and select New => File, and name the file build.xml
    3. Copy the following logic to it and save the file. <?xml version="1.0"?>
      <project name="Copy To Local Tomcat" default="copy" basedir=".">
          <property name="webapp.name" value="BasicStrutsExample"/>
          <property environment="env"/>
          <property name="source.dir" value="../"/>
          <property name="destination.dir" value="C:/Tomcat5.0/webapps/${webapp.name}"/>
          <target name="copy"
              description="Copies all files to tomcat webapps directory">
              <echo message="Copy to: ${destination.dir}"/>
              <echo message="Copy from: ${source.dir}"/>
              <!-- Copy All Main Files -->
              <copy todir="${destination.dir}/">
                  <fileset dir="${source.dir}/WebRoot/">
                      <exclude name="**/*.java"/>
                      <exclude name="**CVS**"/>
                  </fileset>
              </copy>
          </target>
      </project>
  5. Run the ant build
    1. Right click on the build.xml and select Run as => 1 Ant Build NOTE: This should copy all of the files we worked on into the Tomcat webapp directory.
    2. You should get the following output:
      Eclipse with Ant console output
  6. Because we deployed to Tomcat, we need to restart the service so it sees the project.
    1. Double click the monitor Tomcat icon in the toolbar
    2. Select stop
    3. Select start and OK
  7. Now we need to add 2 jar files to Tomcat
    1. Navigate to: C:\Tomcat5.0\webapps\BasicStrutsExample\WEB-INF\lib
    2. Add the jstl-standard.jar file
    3. Add the jstl.jar file
  8. Let's test the application.
    1. Type in the following URL in a web browser: http://localhost:8080/BasicStrutsExample/PersonalData.do.
    2. The browser should display:
      Application inital form page
    3. Once you fill in the text boxes and select the submit button, you should see the following screen:
      Application response page
Congratulations! You have just created your first struts application.

Page 1 Page 2 Page 3