Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This section tries to breakdown the various ways in which Roller uses struts2 and should give you an idea of what tools and code are at your disposal for working with struts2 in Roller.

Important Files

A number of files are changing for with the transition from struts1 -> struts2 and this is a simple list of what files are important in the struts2 configuration and what they are used for.

  • /WEB-INF/classes/struts.xml
    • This is the new struts2 configuration file and it defines the majority of the functionality of the struts2 framework including all of our interceptors, packages, and actions.
  • /WEB-INF/classes/struts.properties
    • This is a companion file to the struts.xml file and it provides settings for how struts2 should run, so things like what default theme to use, what extension our actions use, what object factory to use, etc. This file should rarely need to be changed.
  • /WEB-INF/tiles.xml
    • This is the new tiles2 definition file and defines all of our tiles targets and their components. This works basically the same as the old tiles-config.xml file.
  • src/org/apache/roller/ui/authoring/struts2/editor-menu.xml
    • This is the xml configuration file which defines the tab structure for the "editor" tabbed menu. When you are defining actions which are part of that menu you may need to edit that file.
  • src/org/apache/roller/ui/admin/struts2/admin-menu.xml
    • Same as above but for the "admin" tabbed menu.
  • /WEB-INF/jsps/*/struts2/
    • This is a wildcard, but you get the point. All of the new struts2 jsps are under their own "struts2" directory which separates them from the old struts1 jsps while we migrate. This is just a convention to help us stay organized.
  • src/*/struts2/
    • Same as above but for the source code. All code which is specifically related to running struts2 is placed somewhere in the src tree under a "struts2" directory so that it's easy to identify it's purpose.

UIAction class

One of the goals of the struts2 migration is to make our actions simpler and easier to work on by having all the code and features which are common to all (or most) actions take place automatically and the UIAction class is how we do that. The UIAction class is a base class for actions to extend and provides support for all the things that we expect most of our actions will need to do, such as looking up the authenticated user, applying security checks on weblog permissions, setting action messages and errors, defining a page title, setting the tabbed menu preferences, etc, etc. Many of these things which were handled in custom or inconsistent ways in our struts1 forms are now handled in a simple and consolidated manner now and are provided to action developers for free.

...