Note that there are some explanatory texts on larger screens.

plurals
  1. POstruts 2 file upload no such method Exception
    primarykey
    data
    text
    <p>I'm trying to upload the file using struts2 but with no success. I've been following the struts 2 showcase guide and have gone through so many forums. </p> <p>Here is my JSP</p> <pre><code>&lt;form action="uploadFile" method="post" enctype="multiform/form-data"&gt; &lt;div class="overlay"&gt; &lt;div class="modal"&gt; &lt;div class="content"&gt; &lt;div class="headerText"&gt;Upload File&lt;/div&gt; &lt;div class="fileuploadwindow"&gt; &lt;s:file id="upload" name="upload" label="File"/&gt; &lt;/div&gt; &lt;div class="footerText" align="right"&gt; &lt;input type="button" class="aButton" value="Close" onclick="closeCreate()"&gt; &lt;s:submit class="aButton" value="Upload"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>Here is my Action class</p> <pre><code>private File upload; private String uploadFileName; private String uploadContentType; @Override public String execute() throws Exception { LOGGER.error("uploaded file : "+upload); LOGGER.error("File name : "+uploadFileName); LOGGER.error("content type : "+uploadContentType); return super.execute(); } @Override public String input() throws Exception { // TODO Auto-generated method stub return super.input(); } public String upload() throws Exception { return SUCCESS; } public File getUpload() { return upload; } public void setUpload(File upload) { this.upload = upload; } public String getUploadFileName() { return uploadFileName; } public void setUploadFileName(String uploadFileName) { this.uploadFileName = uploadFileName; } public String getUploadContentType() { return uploadContentType; } public void setUploadContentType(String uploadContentType) { this.uploadContentType = uploadContentType; } </code></pre> <p>When I try to upload the file I get exception as </p> <pre><code>Error setting expression 'upload' with value '[Ljava.lang.String;@66fc92f'ognl.MethodFailedException: Method "setUpload" failed for object org.verientouch.opendrive.actions.UploadFileAction@61a8a328 [java.lang.NoSuchMethodException: org.verientouch.opendrive.actions.UploadFileAction.setUpload([Ljava.lang.String;)] </code></pre> <p>I have also gone through <a href="https://stackoverflow.com/questions/15256761/struts2-file-upload-null-pointer-exception">Struts 2 file upload Null pointer exception</a> and <a href="https://stackoverflow.com/questions/11665627/struts2-cant-upload-file-invalid-field-value">struts2-cant-upload-file-invalid-field-value</a>. but still no success </p> <p>Please suggest where am I going wrong</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload