All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.squid.S3373.html Maven / Gradle / Ivy

There is a newer version: 8.9.0.37768
Show newest version

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>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy