== Why is this an issue?

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:

[source,xml]
----
<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

[source,xml]
----
<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>
----



ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Reduce the number of forwards in this action from m to at most n.


=== Parameters

.threshold
****

----
4
----

Maximum allowed number of "<forward/>" mappings in an "<action>".
****


=== Highlighting

* primary: ``++<action>++`` tag
* secondary: n+ ``++<forward/>++`` tags
** message: Move this forward to another action.


'''
== Comments And Links
(visible only on this page)

=== on 12 Oct 2015, 14:39:44 Ann Campbell wrote:
relates to ``++struts-config.xml++``.

I was very tempted to add ``++struts-config.xml++`` or ``++xml-config++`` or something similar as an implementation detail, but refrained.

endif::env-github,rspecator-view[]
