Learn Java for Web Development

(Tina Meador) #1

178 CHAPTER 4: Building a Web Application Using Struts 2


When you submit an HTML form in a Struts 2 web application, the input is sent to the Java class
called Action. After the action executes, a result selects a resource to render the response, as
illustrated in Figure 4-11.


Figure 4-10. Form of the HelloWorld project


Figure 4-11. Greeting the user


Let’s modify the HelloWorld project you created earlier to add an action, the form that accepts a
user’s input, and the view that greets the user, as illustrated in the directory structure shown in
Figure 4-12.

Free download pdf