We want to write the contents that we read from a file to a textbox.
Can anyone please share how to do this.
This is how we are reading the file
public ActionForward doUpload(ActionMapping mapping,ActionForm form,HttpServletRequest request,
HttpServletResponse response) throws Exception{
ExampleForm csForm = (ExampleForm) form;
// Process the FormFile
FormFile myFile = csForm.getMyFile();
String contentType = myFile.getContentType();
String fileName = myFile.getFileName();
int fileSize = myFile.getFileSize();
byte[] fileData = myFile.getFileData();
System.out.println("contentType: " + contentType);
System.out.println("File Name: " + fileName);
System.out.println("File Size: " + fileSize);
System.out.println("File data: " + fileData);
return mapping.findForward("success");
}
User clicks on the Browse button(implemented using html:file tag) to select the fileName and then clicks on Upload button.
This calls the doUpload method that I mentioned above. After this we need to write the contents of the file to a text box shown below the Upload button on the
jsp.