< Previous | Next >

Lesson 9: Test a Struts application

Test your Struts application in an IBM® WebSphere® or Apache Tomcat runtime environment. You should be able to see the input and output controls that you previously added to the JSP pages in this environment.

About this task

To test your Struts application:

  1. In the Project Explorer, right-click the input.jsp file and select Run As > Run on Server.
  2. In the Server Selection window, select WebSphere Application Server 6.x or Apache Tomcat Server, and click Finish.
  3. If you see the Server Operation window, click Yes to start the server.
  4. Click Finish. The input JSP page opens in a Web browser view.
    A Web browser view shows the input JSP page with three fields and two buttons.
  5. In the JSP page, type the following data in the fields:
    1. In the Day field, type 10.
    2. In the Month field, type 12.
    3. In the Year field, type 1962.
  6. Click the Submit button. The output JSP page is displayed in the Web browser view. The value in the DayOfWeek field should be Wednesday.
    The Web browser view displays the name and value of the DayOfWeek field.
What to do next
You can enter other dates in the fields of the input JSP to compute the corresponding days of the week.

Lesson checkpoint

Congratulations! You successfully tested your Struts application and viewed the output in a simulated Web browser.

You learned to do these tasks:
  • Select a test environment.
  • Type data into the fields of an input JSP page.
  • Display results in an output JSP page in a string format.
< Previous | Next >