Learn Java for Web Development

(Tina Meador) #1
CHAPTER 4: Building a Web Application Using Struts 2 177

Listing 4-18 illustrates index.jsp.


Listing 4-18. index.jsp




Hello World!




Deploy the web application to the servlet container Tomcat 7, open a web browser, and access
http://localhost:8080/helloworldStruts2/, as illustrated in Figure 4-9.


Figure 4-9. Running the HelloWorld application


The HelloWorld application you developed didn’t comprise any actions but a single JSP file that was
generated when you created the project. The purpose of the HelloWorld application you created was
to test the configuration of Struts 2. You will create actions in the following section.


You will create a HelloWorld project that displays a welcome message to the user, as illustrated in
Figure 4-10.

Free download pdf