Rule Definition
When Struts framework is used, it must be used for every page in the application to avoid mixing different technologies and creating an application difficult to maintain and be the source of a lack of robustness.
Remediation
Adapt the application to use Struts for all HTTP Servlets.
Violation Code Sample
---> web.xml
<!-- Struts Action Servlet -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/conf/struts-config.xml</param-value>
</init-param>
<servlet>
<servlet>
<servlet-name>AnotherServlet</servlet-name>
<servlet-class>
// doesn't inherit from org.apache.struts.action.ActionServlet
// but inherits from javax.servlet.http.HttpServlet
com.cast.AnotherServlet // VIOLATION:
</servlet-class>
</servlet>
Fixed Code Sample
<servlet> <servlet-name>action</servlet-name> <servlet-class> org.apache.struts.action.ActionServlet </servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/conf/struts-config.xml</param-value> </init-param> <servlet>
Related Technologies
JEE
Technical Criterion
Architecture - Multi-Layers and Data Access
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.