Introduction


You can access the sample application by typing http://localhost:8080/App1/index.jsp in the browser. The index.jsp contains a single hyperlink. The link is http://localhost:8080/App1/CustomerDetails.jsp. On clicking the link, CustomerDetails.jsp is displayed. CustomerDetails.jsp contains an HTML Form with two buttons ‚ Submit and Cancel. When the user submits the Form by clicking Submit, Success.jsp is shown if the form validations go through. If the validations fail, the same page is shown back to the user with the errors. If the user clicks Cancel on the form, the index.jsp is shown to the user.


Figure 3.1: The JSP flow diagram for the Hello World Struts application.

Directory Structure overview

This is the first time you are building a sample application in this book. Hence we will introduce you to a standard directory structure followed throughout the book when developing applications. Then we will move on to the actual steps involved. Figure 3.2 shows the directory structure.


Figure 3.2: The directory structure used throughout the book for sample Struts applications.

The structure is very logical. The top-level directory for every sample application is named after the application itself. In this case all the files are located under the directory named App1 . The directory src/java beneath App1 contains the Java source files ( CustomerForm.java and CustomerAction.java ) and also the application ‚ s Message Resource Bundle ( App1Messages.properties ). Another directory called web-root beneath App1 contains all the JSPs ( index.jsp , CustomerDetails.jsp and Success.jsp ) and images ( banner.gif ). The web-root contains a WEB-INF sub directory with files web.xml and struts-config.xml .




Struts Survival Guide. Basics to Best Practices
Struts Survival Guide: Basics to Best Practices (J2ee Survival Series)
ISBN: 0974848808
EAN: 2147483647
Year: 2004
Pages: 96

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net