You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Priyanka Vaddadi <Pr...@doj.ca.gov.INVALID> on 2025/05/15 19:50:02 UTC

Struts 7 issue while posting the data

Hi

We are migrating from struts 2.3 to struts 7.0.0

As part of this migration I am facing below issue

There is a action class  in my project  in which we defined SupplierSearchData variable as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {

    private SupplierSearchData supplierMgmtSearchData;

From UI  On click of submit button we are calling some java script function  in which we have below logic
var postData = "supplierMgmtSearchData.supplierName="+supplierName+
                                                                                          "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
                                                                                          "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
                                                                                          "&supplierMgmtSearchData.calendarYear="+calendarYear+
                                                                                          "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
                                                                                          "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
                                                                                          "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
                                                                                          "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
                                                                                          "&supplierMgmtSearchData.queueId="+queueId+
                                                                                          "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
                                                                                          "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
                                                                                          "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
                                                                                          "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
                                                                                          "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
                                                                                          "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
                                                                                          "&supplierMgmtSearchData.supplierId="+supplierId;

                              loadSupplierMgmtSearchResults("<s:url value="supplierMgmtSearch.action" encode="true"/>",postData);

The definition of function  loadSupplierMgmtSearchResults  is as below

function loadSupplierMgmtSearchResults(url, postData){
               alert(1);
               $('#rightSupplierMgmtContainer').html("<img src='../web/images/int/busy.gif'>");
               $.ajax({
                              type: "POST",
                              url: url,
                              data: postData,
                              cache: false,
                              async: false,
                              success: function(html){
                                             $("#rightSupplierMgmtContainer").html(html);
                              },
                              error: function(html, status, error) {
                                             alert("In loadSupplierMgmtSearchResults, Error:"+error);
                              }
               });
               return false;
}


But looks like what ever the data I am posting to action class is not getting mapped to SupplierSearchData in action class

SuplierSearchData class is as below

ublic class SupplierSearchData implements Serializable {


    /**
               *
                */
               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;



Please let me know what is the problem here. If it is parameters , I think we need to annotate with @StrutsParameter . but here the form data should be mapped to object in action class? Is there any annotation available to achieve this

Thanks

Priyanka






CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.

Re: Struts 7 issue while posting the data

Posted by Prasanth <db...@pangburngroup.com>.
The class you have listed below is CgSupplierMgmtSearchAction while the error message is for another class.

>Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected

-Prasanth
On 5/16/25 1:51 PM, Priyanka Vaddadi wrote:
> Hi
>
> I tried using depth = 1 as below
> public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {
> private SupplierSearchData supplierMgmtSearchData;
>
> @StrutsParameter(depth = 1)
>      public void setSupplierMgmtSearchData(SupplierSearchData supplierMgmtSearchData) {
>          this.supplierMgmtSearchData = supplierMgmtSearchData;
>      }
>
>      public SupplierSearchData getSupplierMgmtSearchData() {
>          return supplierMgmtSearchData;
>      }
> }
> Below is the SupplierSearchData class . As there are only strings available in this class and no nested objects, I  am using depth = 1
>
> public class SupplierSearchData implements Serializable {
>
>
>                 private static final long serialVersionUID = 1L;
>                 private String supplierId;
>      private String supplierName;
>      private String cityOfLicense;
>      private String countyOfLicense;
>      private String queueId;
>      private String calendarYear;
>
>      private String receivedDateFrom;
>      private String receivedDateTo;
>      private String approvedDateFrom;
>      private String approvedDateTo;
>
>      private String searchDays;
>      private String supplierFirstName;
>      private String supplierLastName;
>      private String supplierDbaName;
>      private String licenseNumber;
>      private String federalTaxId;
>      private String cityOfBusiness;
>
> }
>
> But still I am getting below error
> 11:31:28,446 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
> Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
> 11:31:28,461 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
> Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
>
>
>
> Thanks and Regards
> Priyanka
>
> From: Priyanka Vaddadi
> Sent: Thursday, May 15, 2025 12:50 PM
> To:user@struts.apache.org
> Subject: Struts 7 issue while posting the data
>
> Hi
>
> We are migrating from struts 2.3 to struts 7.0.0
>
> As part of this migration I am facing below issue
>
> There is a action class  in my project  in which we defined SupplierSearchData variable as below
> public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {
>
>      private SupplierSearchData supplierMgmtSearchData;
>
>  From UI  On click of submit button we are calling some java script function  in which we have below logic
> var postData = "supplierMgmtSearchData.supplierName="+supplierName+
>                                                                                            "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
>                                                                                            "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
>                                                                                            "&supplierMgmtSearchData.calendarYear="+calendarYear+
>                                                                                            "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
>                                                                                            "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
>                                                                                            "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
>                                                                                            "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
>                                                                                            "&supplierMgmtSearchData.queueId="+queueId+
>                                                                                            "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
>                                                                                            "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
>                                                                                            "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
>                                                                                            "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
>                                                                                            "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
>                                                                                            "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
>                                                                                            "&supplierMgmtSearchData.supplierId="+supplierId;
>
>                                loadSupplierMgmtSearchResults("<s:url value="supplierMgmtSearch.action" encode="true"/>",postData);
>
> The definition of function  loadSupplierMgmtSearchResults  is as below
>
> function loadSupplierMgmtSearchResults(url, postData){
>                 alert(1);
>                 $('#rightSupplierMgmtContainer').html("<img src='../web/images/int/busy.gif'>");
>                 $.ajax({
>                                type: "POST",
>                                url: url,
>                                data: postData,
>                                cache: false,
>                                async: false,
>                                success: function(html){
>                                               $("#rightSupplierMgmtContainer").html(html);
>                                },
>                                error: function(html, status, error) {
>                                               alert("In loadSupplierMgmtSearchResults, Error:"+error);
>                                }
>                 });
>                 return false;
> }
>
>
> But looks like what ever the data I am posting to action class is not getting mapped to SupplierSearchData in action class
>
> SuplierSearchData class is as below
>
> ublic class SupplierSearchData implements Serializable {
>
>
>      /**
>                 *
>                  */
>                 private static final long serialVersionUID = 1L;
>                 private String supplierId;
>      private String supplierName;
>      private String cityOfLicense;
>      private String countyOfLicense;
>      private String queueId;
>      private String calendarYear;
>
>
>
> Please let me know what is the problem here. If it is parameters , I think we need to annotate with @StrutsParameter . but here the form data should be mapped to object in action class? Is there any annotation available to achieve this
>
> Thanks
>
> Priyanka
>
>
>
>
>
>
> CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.
>

Re: Struts 7 issue while posting the data

Posted by Prasanth <db...@pangburngroup.com>.
See https://struts.apache.org/security/#defining-and-annotating-your-action-parameters

On 5/16/25 4:34 PM, Dave Newton wrote:
> On Fri, May 16, 2025 at 17:24 Priyanka Vaddadi
> <Pr...@doj.ca.gov.invalid> wrote:
>
>> Parameter injection for method [getSupplierMgmtSearchData] on Action
>> [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is
>> annotated with @StrutsParameter with an appropriate 'depth'.
>
> Is it? The previous snippet showed an annotation on the setter.
>
> Dave
>
> https://struts.apache.org/security/#:~:text=If%20you%20wish%20to%20populate%20a%20DTO%20(Data%20Transfer%20Object)%20instead%20of%20setting%20the%20parameters%20directly%20on%20the%20Action%20class%2C%20youcan%20define%20a%20getter%20for%20the%20DTO%20on%20your%20Action%20class%20instead.%20For%20example%2C%20define%20a%20method%20public%20MyDto%20getFormData()which%20is%20also%20annotated%20by%20@StrutsParameter(depth%20=%201).
> <https://struts.apache.org/security/#:~:text=If%20you%20wish%20to%20populate%20a%20DTO%20%28Data%20Transfer%20Object%29%20instead%20of%20setting%20the%20parameters%20directly%20on%20the%20Action%20class%2C%20youcan%20define%20a%20getter%20for%20the%20DTO%20on%20your%20Action%20class%20instead.%20For%20example%2C%20define%20a%20method%20public%20MyDto%20getFormData%28%29which%20is%20also%20annotated%20by%20@StrutsParameter%28depth%20=%201%29.>
>

Re: Struts 7 issue while posting the data

Posted by Dave Newton <da...@gmail.com>.
On Fri, May 16, 2025 at 17:24 Priyanka Vaddadi
<Pr...@doj.ca.gov.invalid> wrote:

> Parameter injection for method [getSupplierMgmtSearchData] on Action
> [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is
> annotated with @StrutsParameter with an appropriate 'depth'.


Is it? The previous snippet showed an annotation on the setter.

Dave

https://struts.apache.org/security/#:~:text=If%20you%20wish%20to%20populate%20a%20DTO%20(Data%20Transfer%20Object)%20instead%20of%20setting%20the%20parameters%20directly%20on%20the%20Action%20class%2C%20youcan%20define%20a%20getter%20for%20the%20DTO%20on%20your%20Action%20class%20instead.%20For%20example%2C%20define%20a%20method%20public%20MyDto%20getFormData()which%20is%20also%20annotated%20by%20@StrutsParameter(depth%20=%201).
<https://struts.apache.org/security/#:~:text=If%20you%20wish%20to%20populate%20a%20DTO%20%28Data%20Transfer%20Object%29%20instead%20of%20setting%20the%20parameters%20directly%20on%20the%20Action%20class%2C%20youcan%20define%20a%20getter%20for%20the%20DTO%20on%20your%20Action%20class%20instead.%20For%20example%2C%20define%20a%20method%20public%20MyDto%20getFormData%28%29which%20is%20also%20annotated%20by%20@StrutsParameter%28depth%20=%201%29.>

Re: Struts 7 issue while posting the data

Posted by Dave Newton <da...@gmail.com>.
Sounds like a validation error if it’s trying to go to the “input” result.
It might be worth taking a small step back and either get a debugging
environment working or check out some of the existing documentation,
especially if there are places we can improve.

d

em: davelnewton@gmail.com
mo: 908-380-8699
gh: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>



On Fri, May 16, 2025 at 19:47 Priyanka Vaddadi
<Pr...@doj.ca.gov.invalid> wrote:

> Hi
>
> Thanks for that. When I annotate over getter method it worked for me.
> But I am getting one more error while downloading file
> It was working fine in struts 2.3. now while migrating to struts 7, below
> code in struts.xml is not working
>
> <action name="printSupplierLetterInWord" class="action.
> CgSupplierPrintLetterInWordAction">
>                                              <result type = "stream">
>                                              <param
> name="contentType">application/msword</param>
>                                              <param
> name="inputName">inputStream</param>
>                                              <param
> name="contentDisposition">filename="document.rtf"</param>
>                                              </result>
>                                              <result
> name="error">/WEB-INF/jsp/error.jsp</result>
>                               </action>
>
> Error :
>
>
>
> No result defined for  action.CgSupplierPrintLetterInWordAction and result
> input - action -
> vfs:/C:/Users/VADDADP/jboss-eap-8.0.0.Beta/jboss-eap-8.0/standalone/deployments/ems.war/WEB-INF/classes/struts.xml:757:108
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:392)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:296)
>
> deployment.ems.war//org.apache.struts2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
>
> deployment.ems.war//org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
>
> deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.FetchMetadataInterceptor.intercept(FetchMetadataInterceptor.java:78)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.CoopInterceptor.intercept(CoopInterceptor.java:57)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.CoepInterceptor.intercept(CoepInterceptor.java:55)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:140)
>
> deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.parameter.ParametersInterceptor.doIntercept(ParametersInterceptor.java:212)
>
> deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.parameter.ParametersInterceptor.doIntercept(ParametersInterceptor.java:212)
>
> deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:202)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:133)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:92)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
>
> deployment.ems.war//org.apache.struts2.interceptor.ActionFileUploadInterceptor.intercept(ActionFileUploadInterceptor.java:151)
>
> deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeCondition
>
>
> From: Priyanka Vaddadi
> Sent: Friday, May 16, 2025 1:48 PM
> To: user@struts.apache.org
> Subject: RE: Struts 7 issue while posting the data
>
> Hi
>
> Sorry . I attached incorrect log
> Below is the log
> ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor]
> (default task-1) Developer Notification (set struts.devMode to false to
> disable this message):
> Parameter injection for method [getSupplierMgmtSearchData] on Action
> [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is
> annotated with @StrutsParameter with an appropriate 'depth'.
> 13:44:11,831 ERROR
> [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default
> task-1) Developer Notification (set struts.devMode to false to disable this
> message):
> Parameter injection for method [getSupplierMgmtSearchData] on Action
> [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is
> annotated with @StrutsParameter with an appropriate 'depth'.
> 13:44:11,833 ERROR
> [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default
> task-1) Developer Notification (set struts.devMode to false to disable this
> message):
> Parameter injection for method [getSupplierMgmtSearchData] on Action
> [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is
> annotated with @StrutsParameter with an appropriate 'depth'.
>
>
> Thanks and Regards
> Priyanka
>
> From: Priyanka Vaddadi
> Sent: Friday, May 16, 2025 11:51 AM
> To: user@struts.apache.org<ma...@struts.apache.org>
> Subject: RE: Struts 7 issue while posting the data
>
> Hi
>
> I tried using depth = 1 as below
> public final class CgSupplierMgmtSearchAction extends EmsWebAction
> implements ValidationAware {
> private SupplierSearchData supplierMgmtSearchData;
>
> @StrutsParameter(depth = 1)
>     public void setSupplierMgmtSearchData(SupplierSearchData
> supplierMgmtSearchData) {
>         this.supplierMgmtSearchData = supplierMgmtSearchData;
>     }
>
>     public SupplierSearchData getSupplierMgmtSearchData() {
>         return supplierMgmtSearchData;
>     }
> }
> Below is the SupplierSearchData class . As there are only strings
> available in this class and no nested objects, I  am using depth = 1
>
> public class SupplierSearchData implements Serializable {
>
>
>                private static final long serialVersionUID = 1L;
>                private String supplierId;
>     private String supplierName;
>     private String cityOfLicense;
>     private String countyOfLicense;
>     private String queueId;
>     private String calendarYear;
>
>     private String receivedDateFrom;
>     private String receivedDateTo;
>     private String approvedDateFrom;
>     private String approvedDateTo;
>
>     private String searchDays;
>     private String supplierFirstName;
>     private String supplierLastName;
>     private String supplierDbaName;
>     private String licenseNumber;
>     private String federalTaxId;
>     private String cityOfBusiness;
>
> }
>
> But still I am getting below error
> 11:31:28,446 ERROR
> [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default
> task-1) Developer Notification (set struts.devMode to false to disable this
> message):
> Parameter injection for method [getFundraiserMgmtSearchData] on Action
> [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is
> annotated with @StrutsParameter with an appropriate 'depth'.
> 11:31:28,461 ERROR
> [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default
> task-1) Developer Notification (set struts.devMode to false to disable this
> message):
> Parameter injection for method [getFundraiserMgmtSearchData] on Action
> [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is
> annotated with @StrutsParameter with an appropriate 'depth'.
>
>
>
> Thanks and Regards
> Priyanka
>
> From: Priyanka Vaddadi
> Sent: Thursday, May 15, 2025 12:50 PM
> To: user@struts.apache.org<ma...@struts.apache.org>
> Subject: Struts 7 issue while posting the data
>
> Hi
>
> We are migrating from struts 2.3 to struts 7.0.0
>
> As part of this migration I am facing below issue
>
> There is a action class  in my project  in which we defined
> SupplierSearchData variable as below
> public final class CgSupplierMgmtSearchAction extends EmsWebAction
> implements ValidationAware {
>
>     private SupplierSearchData supplierMgmtSearchData;
>
> From UI  On click of submit button we are calling some java script
> function  in which we have below logic
> var postData = "supplierMgmtSearchData.supplierName="+supplierName+
>
>                 "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
>
>                 "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
>
>                 "&supplierMgmtSearchData.calendarYear="+calendarYear+
>
>
> "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
>
>                 "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
>
>
> "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
>
>                 "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
>
>                 "&supplierMgmtSearchData.queueId="+queueId+
>
>
> "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
>
>
> "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
>
>                 "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
>
>                 "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
>
>                 "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
>
>                 "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
>
>                 "&supplierMgmtSearchData.supplierId="+supplierId;
>
>                               loadSupplierMgmtSearchResults("<s:url
> value="supplierMgmtSearch.action" encode="true"/>",postData);
>
> The definition of function  loadSupplierMgmtSearchResults  is as below
>
> function loadSupplierMgmtSearchResults(url, postData){
>                alert(1);
>                $('#rightSupplierMgmtContainer').html("<img
> src='../web/images/int/busy.gif'>");
>                $.ajax({
>                               type: "POST",
>                               url: url,
>                               data: postData,
>                               cache: false,
>                               async: false,
>                               success: function(html){
>
>  $("#rightSupplierMgmtContainer").html(html);
>                               },
>                               error: function(html, status, error) {
>                                              alert("In
> loadSupplierMgmtSearchResults, Error:"+error);
>                               }
>                });
>                return false;
> }
>
>
> But looks like what ever the data I am posting to action class is not
> getting mapped to SupplierSearchData in action class
>
> SuplierSearchData class is as below
>
> ublic class SupplierSearchData implements Serializable {
>
>
>     /**
>                *
>                 */
>                private static final long serialVersionUID = 1L;
>                private String supplierId;
>     private String supplierName;
>     private String cityOfLicense;
>     private String countyOfLicense;
>     private String queueId;
>     private String calendarYear;
>
>
>
> Please let me know what is the problem here. If it is parameters , I think
> we need to annotate with @StrutsParameter . but here the form data should
> be mapped to object in action class? Is there any annotation available to
> achieve this
>
> Thanks
>
> Priyanka
>
>
>
>
>
>
> CONFIDENTIALITY NOTICE: This communication with its contents may contain
> confidential and/or legally privileged information. It is solely for the
> use of the intended recipient(s). Unauthorized interception, review, use or
> disclosure is prohibited and may violate applicable laws including the
> Electronic Communications Privacy Act. If you are not the intended
> recipient, please contact the sender and destroy all copies of the
> communication.
>

RE: Struts 7 issue while posting the data

Posted by Priyanka Vaddadi <Pr...@doj.ca.gov.INVALID>.
Hi

Thanks for that. When I annotate over getter method it worked for me.
But I am getting one more error while downloading file
It was working fine in struts 2.3. now while migrating to struts 7, below  code in struts.xml is not working

<action name="printSupplierLetterInWord" class="action. CgSupplierPrintLetterInWordAction">
                                             <result type = "stream">
                                             <param name="contentType">application/msword</param>
                                             <param name="inputName">inputStream</param>
                                             <param name="contentDisposition">filename="document.rtf"</param>
                                             </result>
                                             <result name="error">/WEB-INF/jsp/error.jsp</result>
                              </action>

Error :



No result defined for  action.CgSupplierPrintLetterInWordAction and result input - action - vfs:/C:/Users/VADDADP/jboss-eap-8.0.0.Beta/jboss-eap-8.0/standalone/deployments/ems.war/WEB-INF/classes/struts.xml:757:108
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:392)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:296)
    deployment.ems.war//org.apache.struts2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    deployment.ems.war//org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:49)
    deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.FetchMetadataInterceptor.intercept(FetchMetadataInterceptor.java:78)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.CoopInterceptor.intercept(CoopInterceptor.java:57)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.CoepInterceptor.intercept(CoepInterceptor.java:55)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.ConversionErrorInterceptor.doIntercept(ConversionErrorInterceptor.java:140)
    deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.parameter.ParametersInterceptor.doIntercept(ParametersInterceptor.java:212)
    deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.parameter.ParametersInterceptor.doIntercept(ParametersInterceptor.java:212)
    deployment.ems.war//org.apache.struts2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:99)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:202)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:69)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:133)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:92)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeConditional(DefaultActionInvocation.java:311)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265)
    deployment.ems.war//org.apache.struts2.interceptor.ActionFileUploadInterceptor.intercept(ActionFileUploadInterceptor.java:151)
    deployment.ems.war//org.apache.struts2.DefaultActionInvocation.executeCondition


From: Priyanka Vaddadi
Sent: Friday, May 16, 2025 1:48 PM
To: user@struts.apache.org
Subject: RE: Struts 7 issue while posting the data

Hi

Sorry . I attached incorrect log
Below is the log
ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getSupplierMgmtSearchData] on Action [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
13:44:11,831 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getSupplierMgmtSearchData] on Action [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
13:44:11,833 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getSupplierMgmtSearchData] on Action [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.


Thanks and Regards
Priyanka

From: Priyanka Vaddadi
Sent: Friday, May 16, 2025 11:51 AM
To: user@struts.apache.org<ma...@struts.apache.org>
Subject: RE: Struts 7 issue while posting the data

Hi

I tried using depth = 1 as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {
private SupplierSearchData supplierMgmtSearchData;

@StrutsParameter(depth = 1)
    public void setSupplierMgmtSearchData(SupplierSearchData supplierMgmtSearchData) {
        this.supplierMgmtSearchData = supplierMgmtSearchData;
    }

    public SupplierSearchData getSupplierMgmtSearchData() {
        return supplierMgmtSearchData;
    }
}
Below is the SupplierSearchData class . As there are only strings available in this class and no nested objects, I  am using depth = 1

public class SupplierSearchData implements Serializable {


               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;

    private String receivedDateFrom;
    private String receivedDateTo;
    private String approvedDateFrom;
    private String approvedDateTo;

    private String searchDays;
    private String supplierFirstName;
    private String supplierLastName;
    private String supplierDbaName;
    private String licenseNumber;
    private String federalTaxId;
    private String cityOfBusiness;

}

But still I am getting below error
11:31:28,446 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
11:31:28,461 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.



Thanks and Regards
Priyanka

From: Priyanka Vaddadi
Sent: Thursday, May 15, 2025 12:50 PM
To: user@struts.apache.org<ma...@struts.apache.org>
Subject: Struts 7 issue while posting the data

Hi

We are migrating from struts 2.3 to struts 7.0.0

As part of this migration I am facing below issue

There is a action class  in my project  in which we defined SupplierSearchData variable as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {

    private SupplierSearchData supplierMgmtSearchData;

From UI  On click of submit button we are calling some java script function  in which we have below logic
var postData = "supplierMgmtSearchData.supplierName="+supplierName+
                                                                                          "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
                                                                                          "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
                                                                                          "&supplierMgmtSearchData.calendarYear="+calendarYear+
                                                                                          "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
                                                                                          "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
                                                                                          "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
                                                                                          "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
                                                                                          "&supplierMgmtSearchData.queueId="+queueId+
                                                                                          "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
                                                                                          "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
                                                                                          "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
                                                                                          "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
                                                                                          "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
                                                                                          "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
                                                                                          "&supplierMgmtSearchData.supplierId="+supplierId;

                              loadSupplierMgmtSearchResults("<s:url value="supplierMgmtSearch.action" encode="true"/>",postData);

The definition of function  loadSupplierMgmtSearchResults  is as below

function loadSupplierMgmtSearchResults(url, postData){
               alert(1);
               $('#rightSupplierMgmtContainer').html("<img src='../web/images/int/busy.gif'>");
               $.ajax({
                              type: "POST",
                              url: url,
                              data: postData,
                              cache: false,
                              async: false,
                              success: function(html){
                                             $("#rightSupplierMgmtContainer").html(html);
                              },
                              error: function(html, status, error) {
                                             alert("In loadSupplierMgmtSearchResults, Error:"+error);
                              }
               });
               return false;
}


But looks like what ever the data I am posting to action class is not getting mapped to SupplierSearchData in action class

SuplierSearchData class is as below

ublic class SupplierSearchData implements Serializable {


    /**
               *
                */
               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;



Please let me know what is the problem here. If it is parameters , I think we need to annotate with @StrutsParameter . but here the form data should be mapped to object in action class? Is there any annotation available to achieve this

Thanks

Priyanka






CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.

RE: Struts 7 issue while posting the data

Posted by Priyanka Vaddadi <Pr...@doj.ca.gov.INVALID>.
Hi

Sorry . I attached incorrect log
Below is the log
ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getSupplierMgmtSearchData] on Action [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
13:44:11,831 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getSupplierMgmtSearchData] on Action [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
13:44:11,833 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getSupplierMgmtSearchData] on Action [gov.ca.doj.ems.action.CgSupplierMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.


Thanks and Regards
Priyanka

From: Priyanka Vaddadi
Sent: Friday, May 16, 2025 11:51 AM
To: user@struts.apache.org
Subject: RE: Struts 7 issue while posting the data

Hi

I tried using depth = 1 as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {
private SupplierSearchData supplierMgmtSearchData;

@StrutsParameter(depth = 1)
    public void setSupplierMgmtSearchData(SupplierSearchData supplierMgmtSearchData) {
        this.supplierMgmtSearchData = supplierMgmtSearchData;
    }

    public SupplierSearchData getSupplierMgmtSearchData() {
        return supplierMgmtSearchData;
    }
}
Below is the SupplierSearchData class . As there are only strings available in this class and no nested objects, I  am using depth = 1

public class SupplierSearchData implements Serializable {


               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;

    private String receivedDateFrom;
    private String receivedDateTo;
    private String approvedDateFrom;
    private String approvedDateTo;

    private String searchDays;
    private String supplierFirstName;
    private String supplierLastName;
    private String supplierDbaName;
    private String licenseNumber;
    private String federalTaxId;
    private String cityOfBusiness;

}

But still I am getting below error
11:31:28,446 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
11:31:28,461 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.



Thanks and Regards
Priyanka

From: Priyanka Vaddadi
Sent: Thursday, May 15, 2025 12:50 PM
To: user@struts.apache.org<ma...@struts.apache.org>
Subject: Struts 7 issue while posting the data

Hi

We are migrating from struts 2.3 to struts 7.0.0

As part of this migration I am facing below issue

There is a action class  in my project  in which we defined SupplierSearchData variable as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {

    private SupplierSearchData supplierMgmtSearchData;

From UI  On click of submit button we are calling some java script function  in which we have below logic
var postData = "supplierMgmtSearchData.supplierName="+supplierName+
                                                                                          "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
                                                                                          "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
                                                                                          "&supplierMgmtSearchData.calendarYear="+calendarYear+
                                                                                          "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
                                                                                          "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
                                                                                          "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
                                                                                          "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
                                                                                          "&supplierMgmtSearchData.queueId="+queueId+
                                                                                          "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
                                                                                          "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
                                                                                          "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
                                                                                          "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
                                                                                          "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
                                                                                          "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
                                                                                          "&supplierMgmtSearchData.supplierId="+supplierId;

                              loadSupplierMgmtSearchResults("<s:url value="supplierMgmtSearch.action" encode="true"/>",postData);

The definition of function  loadSupplierMgmtSearchResults  is as below

function loadSupplierMgmtSearchResults(url, postData){
               alert(1);
               $('#rightSupplierMgmtContainer').html("<img src='../web/images/int/busy.gif'>");
               $.ajax({
                              type: "POST",
                              url: url,
                              data: postData,
                              cache: false,
                              async: false,
                              success: function(html){
                                             $("#rightSupplierMgmtContainer").html(html);
                              },
                              error: function(html, status, error) {
                                             alert("In loadSupplierMgmtSearchResults, Error:"+error);
                              }
               });
               return false;
}


But looks like what ever the data I am posting to action class is not getting mapped to SupplierSearchData in action class

SuplierSearchData class is as below

ublic class SupplierSearchData implements Serializable {


    /**
               *
                */
               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;



Please let me know what is the problem here. If it is parameters , I think we need to annotate with @StrutsParameter . but here the form data should be mapped to object in action class? Is there any annotation available to achieve this

Thanks

Priyanka






CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.

RE: Struts 7 issue while posting the data

Posted by Priyanka Vaddadi <Pr...@doj.ca.gov.INVALID>.
Hi

I tried using depth = 1 as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {
private SupplierSearchData supplierMgmtSearchData;

@StrutsParameter(depth = 1)
    public void setSupplierMgmtSearchData(SupplierSearchData supplierMgmtSearchData) {
        this.supplierMgmtSearchData = supplierMgmtSearchData;
    }

    public SupplierSearchData getSupplierMgmtSearchData() {
        return supplierMgmtSearchData;
    }
}
Below is the SupplierSearchData class . As there are only strings available in this class and no nested objects, I  am using depth = 1

public class SupplierSearchData implements Serializable {


               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;

    private String receivedDateFrom;
    private String receivedDateTo;
    private String approvedDateFrom;
    private String approvedDateTo;

    private String searchDays;
    private String supplierFirstName;
    private String supplierLastName;
    private String supplierDbaName;
    private String licenseNumber;
    private String federalTaxId;
    private String cityOfBusiness;

}

But still I am getting below error
11:31:28,446 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.
11:31:28,461 ERROR [org.apache.struts2.interceptor.parameter.ParametersInterceptor] (default task-1) Developer Notification (set struts.devMode to false to disable this message):
Parameter injection for method [getFundraiserMgmtSearchData] on Action [gov.ca.doj.ems.action.CgFundraiserMgmtSearchAction] rejected. Ensure it is annotated with @StrutsParameter with an appropriate 'depth'.



Thanks and Regards
Priyanka

From: Priyanka Vaddadi
Sent: Thursday, May 15, 2025 12:50 PM
To: user@struts.apache.org
Subject: Struts 7 issue while posting the data

Hi

We are migrating from struts 2.3 to struts 7.0.0

As part of this migration I am facing below issue

There is a action class  in my project  in which we defined SupplierSearchData variable as below
public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {

    private SupplierSearchData supplierMgmtSearchData;

From UI  On click of submit button we are calling some java script function  in which we have below logic
var postData = "supplierMgmtSearchData.supplierName="+supplierName+
                                                                                          "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
                                                                                          "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
                                                                                          "&supplierMgmtSearchData.calendarYear="+calendarYear+
                                                                                          "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
                                                                                          "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
                                                                                          "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
                                                                                          "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
                                                                                          "&supplierMgmtSearchData.queueId="+queueId+
                                                                                          "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
                                                                                          "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
                                                                                          "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
                                                                                          "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
                                                                                          "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
                                                                                          "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
                                                                                          "&supplierMgmtSearchData.supplierId="+supplierId;

                              loadSupplierMgmtSearchResults("<s:url value="supplierMgmtSearch.action" encode="true"/>",postData);

The definition of function  loadSupplierMgmtSearchResults  is as below

function loadSupplierMgmtSearchResults(url, postData){
               alert(1);
               $('#rightSupplierMgmtContainer').html("<img src='../web/images/int/busy.gif'>");
               $.ajax({
                              type: "POST",
                              url: url,
                              data: postData,
                              cache: false,
                              async: false,
                              success: function(html){
                                             $("#rightSupplierMgmtContainer").html(html);
                              },
                              error: function(html, status, error) {
                                             alert("In loadSupplierMgmtSearchResults, Error:"+error);
                              }
               });
               return false;
}


But looks like what ever the data I am posting to action class is not getting mapped to SupplierSearchData in action class

SuplierSearchData class is as below

ublic class SupplierSearchData implements Serializable {


    /**
               *
                */
               private static final long serialVersionUID = 1L;
               private String supplierId;
    private String supplierName;
    private String cityOfLicense;
    private String countyOfLicense;
    private String queueId;
    private String calendarYear;



Please let me know what is the problem here. If it is parameters , I think we need to annotate with @StrutsParameter . but here the form data should be mapped to object in action class? Is there any annotation available to achieve this

Thanks

Priyanka






CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.

Re: Struts 7 issue while posting the data

Posted by Prasanth <db...@pangburngroup.com>.
You have to annotate the set method for that class in your action with @StrutsParameter(depth=1).

----------------------------
int depth
The depth to which parameter injection is permitted, where a depth of 0 only allows setters/fields directly on the action class. Setting within a POJO on an action will require a depth of 1 or more 
depending on the level of nesting within the POJO.

In a practical sense, the depth dictates the number of periods or brackets that can appear in the parameter name.

Default:
    0

----------------------------

Thanks,
Prasanth

On 5/15/25 2:50 PM, Priyanka Vaddadi wrote:
> Hi
>
> We are migrating from struts 2.3 to struts 7.0.0
>
> As part of this migration I am facing below issue
>
> There is a action class  in my project  in which we defined SupplierSearchData variable as below
> public final class CgSupplierMgmtSearchAction extends EmsWebAction implements ValidationAware {
>
>      private SupplierSearchData supplierMgmtSearchData;
>
>  From UI  On click of submit button we are calling some java script function  in which we have below logic
> var postData = "supplierMgmtSearchData.supplierName="+supplierName+
>                                                                                            "&supplierMgmtSearchData.cityOfLicense="+cityOfLicense+
>                                                                                            "&supplierMgmtSearchData.countyOfLicense="+countyOfLicense+
>                                                                                            "&supplierMgmtSearchData.calendarYear="+calendarYear+
>                                                                                            "&supplierMgmtSearchData.receivedDateFrom="+receivedDateFrom+
>                                                                                            "&supplierMgmtSearchData.receivedDateTo="+receivedDateTo+
>                                                                                            "&supplierMgmtSearchData.approvedDateFrom="+approvedDateFrom+
>                                                                                            "&supplierMgmtSearchData.approvedDateTo="+approvedDateTo+
>                                                                                            "&supplierMgmtSearchData.queueId="+queueId+
>                                                                                            "&supplierMgmtSearchData.supplierFirstName="+supplierFirstName+
>                                                                                            "&supplierMgmtSearchData.supplierLastName="+supplierLastName+
>                                                                                            "&supplierMgmtSearchData.supplierDbaName="+supplierDbaName+
>                                                                                            "&supplierMgmtSearchData.licenseNumber="+licenseNumber+
>                                                                                            "&supplierMgmtSearchData.cityOfBusiness="+cityOfBusiness+
>                                                                                            "&supplierMgmtSearchData.federalTaxId="+federalTaxId+
>                                                                                            "&supplierMgmtSearchData.supplierId="+supplierId;
>
>                                loadSupplierMgmtSearchResults("<s:url value="supplierMgmtSearch.action" encode="true"/>",postData);
>
> The definition of function  loadSupplierMgmtSearchResults  is as below
>
> function loadSupplierMgmtSearchResults(url, postData){
>                 alert(1);
>                 $('#rightSupplierMgmtContainer').html("<img src='../web/images/int/busy.gif'>");
>                 $.ajax({
>                                type: "POST",
>                                url: url,
>                                data: postData,
>                                cache: false,
>                                async: false,
>                                success: function(html){
>                                               $("#rightSupplierMgmtContainer").html(html);
>                                },
>                                error: function(html, status, error) {
>                                               alert("In loadSupplierMgmtSearchResults, Error:"+error);
>                                }
>                 });
>                 return false;
> }
>
>
> But looks like what ever the data I am posting to action class is not getting mapped to SupplierSearchData in action class
>
> SuplierSearchData class is as below
>
> ublic class SupplierSearchData implements Serializable {
>
>
>      /**
>                 *
>                  */
>                 private static final long serialVersionUID = 1L;
>                 private String supplierId;
>      private String supplierName;
>      private String cityOfLicense;
>      private String countyOfLicense;
>      private String queueId;
>      private String calendarYear;
>
>
>
> Please let me know what is the problem here. If it is parameters , I think we need to annotate with @StrutsParameter . but here the form data should be mapped to object in action class? Is there any annotation available to achieve this
>
> Thanks
>
> Priyanka
>
>
>
>
>
>
> CONFIDENTIALITY NOTICE: This communication with its contents may contain confidential and/or legally privileged information. It is solely for the use of the intended recipient(s). Unauthorized interception, review, use or disclosure is prohibited and may violate applicable laws including the Electronic Communications Privacy Act. If you are not the intended recipient, please contact the sender and destroy all copies of the communication.
>