Hi We are facing issue while uploading file with struts 7.0.0/ By using below code we are attaching the file on UI
<tr> <td> <input type="text" name="documentData.documentName" id="documentData.documentName" value="" maxlength="50" class="text medium" style="width:200px;"/> </td> <td> <input type="file" name="documentData.documentImage" id="documentData.documentImage" size="50"/> </td> </tr> Below is the action class public String execute() { logger.debug("In CgFundraiserMgmtAddDocsAction.execute"); addRequiredRole(EmsConstants.ROLE_BGC_SUPERVISOR); addRequiredRole(EmsConstants.ROLE_CG_ANALYST); String status = super.execute(); if (status == SUCCESS) { CgManager manager = new CgManager(); try { if (documentData.getDocumentImage() != null) { documentData.setDocumentBytes(EmsUtil.getBytesFromFile(documentData.getDocumentImage())); documentData.setDocumentSize(documentData.getDocumentImage().length()); } manager.addFundraiserDocument(documentData,getUserId()); fundraiserDisplayData = manager.getFundraiserDataForDisplay(documentData.getFundraiserId()); fundraiserDetailData = manager.getFundraiserDetails(documentData.getFundraiserId()); status = SUCCESS; } catch (Exception e) { logger.error("In CgFundraiserMgmtAddDocsAction.execute", e); addActionError(getText("error.system")); status = ERROR; } } return status; } public void setFundraiserDisplayData(FundraiserSearchResultsData fundraiserDisplayData) { this.fundraiserDisplayData = fundraiserDisplayData; } public FundraiserSearchResultsData getFundraiserDisplayData() { return fundraiserDisplayData; } public void setFundraiserDetailData(FundraiserDetailData fundraiserDetailData) { this.fundraiserDetailData = fundraiserDetailData; } public FundraiserDetailData getFundraiserDetailData() { return fundraiserDetailData; } public void setDocumentData(FundraiserDocumentData documentData) { this.documentData = documentData; } @StrutsParameter(depth = 1) public FundraiserDocumentData getDocumentData() { return documentData; } } Below is the FundraiserDocumentData class public class FundraiserDocumentData extends EmsData implements Serializable { /** * */ private static final long serialVersionUID = 1L; private int fundraiserId; private int fundraiserDocumentId; private File documentImage; private String documentImageContentType; private String documentImageFileName; private byte[] documentBytes; private long documentSize; private int documentTypeId; private String documentTypeName; private String documentName; private String receivedDate; WE are receiving document name and document received date and documentTYpeId. But not actual content of document. I mean the below variable is not getting populated with data. But the same variable gets populated with data with struts 2.3. Please let me know what is the problem here with struts 7 private File documentImage; 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.