Web programming

Units WEB1P and WEB2P

Struts 2

How Struts 2 is organised

Struts 2 has a different set of components to Struts 1. Its major component pieces are:

Struts 2 actions don't require a separate ActionForm class in order to pass request parameters to them. Instead, properties of the action class are used for that purpose. Interceptors can be configured to populate these automatically.

Struts2 architecture
  1. The web browser requests a resource (/mypage.action, /reports/myreport.pdf, et cetera)
  2. The Filter Dispatcher looks at the request and determines the appropriate Action
  3. The Interceptors automatically apply common functionality to the request, like workflow, validation, and file upload handling
  4. The Action method executes, usually storing and/or retrieving information from a database
  5. The Result renders the output to the browser, be it HTML, images, PDF, or something else
Struts 2 architecture (from here)  

Examples

Struts2HelloWorld webapp based on the Struts 2 tutorial

Reading

 

Last updated by Prof Jim Briggs of the School of Computing at the University of Portsmouth

 
The web programming units include some material that was formerly part of the WPRMP, WECPP, WPSSM and WEMAM units.