Rule Definition
In Struts, for better readability and to avoid unexpected behaviour, it is recommended to have a unique name as entry point.
Remediation
Don't have local forward with same name as global forward
Violation Code Sample
<action-mappings type="org.apache.struts.action.ActionMapping"> <action path="/login" parameter="" input="/index.jsp" scope="request" name="loginForm" type="com.jmd.test.struts.controleur.LoginAction"> <global-forward name="success" path="/welcomeglobal.jsp" redirect="false" /> <forward name="success" path="/welcome.jsp" redirect="false" /> <forward name="error" path="/index.jsp" redirect="false" /> </action> </action-mappings>
Fixed Code Sample
<action-mappings type="org.apache.struts.action.ActionMapping"> <action path="/login" parameter="" input="/index.jsp" scope="request" name="loginForm" type="com.jmd.test.struts.controleur.LoginAction"> <forward name="success" path="/welcome.jsp" redirect="false" /> <forward name="error" path="/index.jsp" redirect="false" /> </action> </action-mappings>
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.