Re: Struts 7 issue while posting the data

Prasanth <[email protected]> Fri, 16 May 2025 14:09:55 -0500
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <[email protected]>
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:[email protected]
> 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.
>