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.