Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

Configuration

Action Mapping

Please see http://cwiki.apache.org/WW/convention-plugin.html for more details - we are planning to switch to the Conventions plugin as it is a superior action mapping tool than the previous version (2.1.2) of Struts that we were using. However, there is currently a bug in XWork 2.1.2 (or OGNL, not sure yet) that has not been fixed yet, see https://issues.apache.org/struts/browse/WW-2971 for more details.

There are currently two ways to map actions in the Struts 2 version of tDAR:

  1. Explicit mapping in WEB-INF/classes/struts.xml
  2. implicit mapping in the filesystem, where a .ftl or .jsp file in src/main/webapp is parsed and delivered for content.

    Implicit mapping example

    If you create a file, test.ftl in the src/main/webapp/blougat directory, then you should be able to see the contents of that file at http://localhost:8080/tdar/blougat/test

Deprecated

Notes: Using custom org.tdar.struts.TdarActionMapper - tried to get CompositeActionMapper working to map the empty action context but was unsuccessful (and documentation on the Struts site is inaccurate). TdarActionMapper is basically the same thing as the Restful2ActionMapper, just set up so that we can understand the process of action mapping more closely. Subsequent changes in Struts action mapping, e.g., the Conventions plug-in, should be monitored and patched with TdarActionMapper (or replace it entirely).

<constant name='struts.mapper.class' value='org.apache.struts2.dispatcher.mapper.Restful2ActionMapper'/>
<constant name='struts.enable.SlashesInActionNames' value='true'/>

Implementation

Consider using Spring Webflow for resource editing and registration. Goal is to have a TurboTax-like workflow.

Miscellaneous Issues / Notes

Spring uses JDK dynamic proxies by default, which means that any autowired proxied class (i.e., the *Service classes, etc.) get injected with the interface type, not the concrete class. For example, if UniqueEmailValidator wants a PersonService to talk to, it will only get a Service from Spring unless explicitly wired. In order to overcome this, need to set

<tx:annotation-driven proxy-target-class='true' />

External links to Struts 2 documentation

  • No labels