Yes! It’s Struts in a nutshell

Obviously this is an overview, and we’ve left out pretty much all of the details, but this is the basic idea behind the Struts framework. Let’s look at a few more details, starting with the fact that we’ve changed all the names...

image with no caption

Key Struts Components

Action Servlet - You’ll need only one of these per application.

Best of all, you don’t even have to write it, Struts provides it.

Form Beans - You’ll write one of these for each HTML form your app needs to process. They are Java beans, and once the Struts Action Servlet has called the setters on the form bean (to populate the bean with form parameters), it will call the bean’s validate() method. This is a great place to put data conversion and error handling logic.

Action Objects - Generally, an action maps to a single activity in a use-case. It has a call-back-like method called execute(), which is a great place to get the validated form params, and call model components. Think of the Action object as kind of a “servlet lite”.

struts-config.xml - This is the Struts-specific deployment descriptor. In it you’ll map: request URLs to Actions, Actions to Form beans, and Actions to views.

image with no caption
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset