Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Deploying the Application

Compile the ActionForms and Action classes using the javac command. You will need to ensure that the servlet classes (servlet.jar in tomcat/lib) as well as the Struts classes (struts.jar) are set in the CLASSPATH environment variable.

Create a directory, auctionstation, in the webapps directory of the tomcat installation. (Auction Station was the name of the application in the book.) Create the following directory structure and copy the files, as shown in Listing 4.

Listing 4 Deploying the Message Board Application

+ jakarta-tomcat
    ..
    + webapps
        + auctionstation
            - help.jsp
            - message.jsp
            - showmessage.jsp
            + Web-inf
                + classes
                   - Identity.class (compiled)
                   - Message.class (compiled)
                   - MessageBoard.class (compiled)
                   - OOMessage.class (compiled)
                   - ApplicationResources.properties
                + lib
                   - struts.jar (from the struts archive)
                   - web.xml (from Listing 1.11)

Figure 1 shows the input page with data entered by a user (me!). Figure 2 shows the output page displaying the message, and Figure 3 shows the input page displayed with error messages when the user does not specify the user name and a message body.

Figure 1

Displaying the input form with data entered by a user

Figure 2

Output page displaying the message posted by the user

Figure 3

Input page redisplayed with the error messages

In the next article, we will add another action class to create a reply to a message and to populate the message form with existing values.

  • + Share This
  • 🔖 Save To Your Account