In my struts.xml a convention is followed to call actions for a particular action class like this:
struts.xml:
<package name="cdot.oss.cmsat.gma.struts" extends="struts-default" namespace="/">
<action name="*ConfigureTspThreshold"
class="cdot.oss.cmsat.gma.struts.ConfigureTspThresholdAction" method="{1}">
<result name="display">pages/ConfigureTspThresholdInput.jsp</result>
</action>
</package>
I get method name through wildcard and ConfigureTspThresholdAction is the class name.
I am using struts2-json-plugin to convert data to JSON. Now, for some actions I want to return JSON data using Struts2 JSON plugin.
So I need to use extends json-default and result-type json for some actions like this:
<action name="*ConfigureTspThreshold" class="cdot.oss.cmsat.gma.struts.ConfigureTspThresholdAction" method="{1}">
<result type="json">
<param name="excludeProperties">
tspNameIdMap
</param>
</result>
</action>
<action name="*ConfigureTspThreshold" class="cdot.oss.cmsat.gma.struts.ConfigureTspThresholdAction"
method="{1}">
<result type="json">
<param name="excludeProperties">
thresholdParameters
</param>
</result>
</action>
So different exclude-properties with same result-type json .
How to fit these JSON result types in the convention followed?
As the last two actions will conflict as they have same result type json ?
One of the option is to use dynamic parameters in the result configuration. You can always modify the result in the action before result is executed. Look at this answer.