It makes sense to handle all related actions in the same place. Thus, the same <action>
might logically handle all facets of
CRUD on an entity, with no confusion in the naming about which <forward/>
handles which facet. But go very far beyond that, and it
becomes difficult to maintain a transparent naming convention.
So to ease maintenance, this rule raises an issue when an <action>
has more than the allowed number of
<forward/>
tags.
Noncompliant code example
With the default threshold of 4:
<action path='/book' type='myapp.BookDispatchAction' name='form' parameter='method'>
<forward name='create' path='/WEB-INF/jsp/BookCreate.jspx' redirect='false'/>
<forward name='read' path='/WEB-INF/jsp/BookDetails' redirect='false'/>
<forward name='update' path='/WEB-INF/jsp/BookUpdate.jspx' redirect='false'/>
<forward name='delete' path='/WEB-INF/jsp/BookDelete.jspx' redirect='false'/>
<forward name='authorRead' path='WEB-INF/jsp/AuthorDetails' redirect='false'/> <!-- Noncompliant -->
</action>
Compliant solution
<action path='/book' type='myapp.BookDispatchAction' name='bookForm' parameter='method'>
<forward name='create' path='/WEB-INF/jsp/BookCreate.jspx' redirect='false'/>
<forward name='read' path='/WEB-INF/jsp/BookDetails' redirect='false'/>
<forward name='update' path='/WEB-INF/jsp/BookUpdate.jspx' redirect='false'/>
<forward name='delete' path='/WEB-INF/jsp/BookDelete.jspx' redirect='false'/>
</action>
<action path='/author' type='myapp.AuthorDispatchAction' name='authorForm' parameter='method'>
<forward name='authorRead' path='WEB-INF/jsp/AuthorDetails' redirect='false'/>
</action>