Web-Inf->lib has following jars :-" name="description">

File Upload in struts2 - Invalid field value for field

Ads
 

File Upload in struts2 - Invalid field value for field

Hi I am also getting following error while trying to upload a file using struts file tag :

Invalid field value for field "upload".

My webContents->Web-Inf->lib has following jars :-

commons-collections-3.2.jar commons-fileupload-1.2.1.jar commons-io-1.3.jar commons-logging-1.1.jar freemarker-2.3.8.jar ognl-2.6.11.jar struts2-core-2.0.11.jar xwork-2.0.4.jar

upload.jsp -> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> Insert title here

struts.xml ->

    <action name="uploadingFile" class="action.FileUpload">
        <result name="success">/uploadSuccessful.jsp</result>
        <result name="input">/upload.jsp</result>
    </action>

</package>

package 'action' has FileUpload.java ->

package action;

import java.io.File; import java.io.IOException;

import org.apache.commons.io.FileUtils; import com.opensymphony.xwork2.ActionSupport;

public class FileUpload extends ActionSupport {

private static final long serialVersionUID = 1L;
private File upload;
private String uploadContentType;
    private String uploadFileName;

public String execute() {
    System.out.println("inside execute");
        String fullFileName = "e:\\upload\\myFile.txt";
        File theFile = new File(fullFileName);

        try {
            FileUtils.copyFile(upload, theFile);
            return "success";
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return "input";
        }       

}


public File getUpload() {
    return upload;
}


public void setUpload(File upload) {
    this.upload = upload;
}

public String getUploadContentType() {
    return uploadContentType;
}

public void setUploadContentType(String uploadContentType) {
    this.uploadContentType = uploadContentType;
}

public String getUploadFileName() {
    return uploadFileName;
}

public void setUploadFileName(String uploadFileName) {
    this.uploadFileName = uploadFileName;
}

}

As i click submit .. i get Invalid field value for field "upload". on jsp page but not in console

Please guide I am stuck to this for long

View Answers

Ads









Related Tutorials/Questions & Answers:
this is my file upload page, here i am not getting tags input field value to my servlet,please suggest a solution?
this is my file upload page, here i am not getting tags input field value to my...;tr><td><input type="submit" value="Upload File" /></td><...('DIV'); div.innerHTML = '<tr><td>select files to upload
I need jsp code for how to write text field value into property file.
I need jsp code for how to write text field value into property file.  Hi , I need to set the text field value into property file using jsp code. Example : Username : Valar , I have entered the value "Valar" in the text field
Advertisements
ModuleNotFoundError: No module named 'dynamic-upload-image-field'
ModuleNotFoundError: No module named 'dynamic-upload-image-field'  Hi...: No module named 'dynamic-upload-image-field' How to remove the ModuleNotFoundError: No module named 'dynamic-upload-image-field' error? Thanks
ModuleNotFoundError: No module named 'dynamic-upload-image-field'
ModuleNotFoundError: No module named 'dynamic-upload-image-field'  Hi...: No module named 'dynamic-upload-image-field' How to remove the ModuleNotFoundError: No module named 'dynamic-upload-image-field' error? Thanks
ModuleNotFoundError: No module named 'dynamic-upload-image-field'
ModuleNotFoundError: No module named 'dynamic-upload-image-field'  Hi...: No module named 'dynamic-upload-image-field' How to remove the ModuleNotFoundError: No module named 'dynamic-upload-image-field' error? Thanks
Text field save as word file
Text field save as word file  Dear experts At run how to save set of text field contains text into single Word file. To save in our desktop computer. Solve my problem
Inserting a value to an Enum field in Table
Inserting a value to an Enum field in Table  I'm writing a code that creates a user account and sends the result to the user table in a mysql... this enum field in the table
ModuleNotFoundError: No module named 'django-multitype-file-field'
ModuleNotFoundError: No module named 'django-multitype-file-field'  ...: No module named 'django-multitype-file-field' How to remove the ModuleNotFoundError: No module named 'django-multitype-file-field' error? Thanks
form field mapping with pdf file using java
form field mapping with pdf file using java   Hai all, I have one... file. means, if click on text field according that perticular field .the data related to the field in pdf file should marked with a color. can any one give
how to get the value of a label field of option tag in javascript?
how to get the value of a label field of option tag in javascript?  example <select> <option label="2" value="A">A</option> <option label="5" value="B">B</option> <
Can not input value into text field which use sx:datetimepicker
Can not input value into text field which use sx:datetimepicker  I am... value from calendar, it runs normal. But i input value from keyboard by hands and then i move focus to other element, that value is lost. Thus, i can not input
Can not input value into text field which use sx:datetimepicker
Can not input value into text field which use sx:datetimepicker  I am..." cssStyle="font-size:13.5px" accesskey="true" />"); I input value from calendar, it runs normal. But i input value from keyboard by hands and then i move focus
How to add radio button value in a table for particular field?
How to add radio button value in a table for particular field?  Hi,I have a jsp form in which one static field for date and below a dynamic table... one radio button for text field then it insert only one value absent OR present
how to display data from database according to entered value in search field
how to display data from database according to entered value in search field  this is my search.jsp file <%@taglib prefix="c" uri="http...;%@include file = "header.jsp" %> <%@include file = "menu.jsp" %>
struts2 upload image public_html
struts2 upload image public_html  How to upload images in public_html file in Struts 2 application. Thanks in advance
File format validation and text field validation in java swings
File format validation and text field validation in java swings   i am reading a jpg image file throuh jfilechooser in java swings,when we press browse button for selecting file it will display filechooser in this process when
How to collect Java input field value display into Jtable?
How to collect Java input field value display into Jtable?  <p>We would like to know how to collection input field data into Jtable with the following format. Please advise.</p> <ol> <li>text field
Example of struts2.2.1 field validator.
how to validate form field or user input in struts2Struts2 used a xml file for validation called validation.xml.  Struts2 provides two ways for defining validator in XML file. Field validator Non-field validator
AJAX file upload
AJAX file upload If you want to upload file asynchronously means without... Demo URL http://www.webtoolkit.info/demo/ajax-file-upload Description You need to create a form with file fields you wish to upload and define
Upload file with ather Fieldn
Upload file with ather Fieldn  hello i want upload file with other...,Filedate,file_upload) see( upload file with path) i can send data to database, but adding anther field not access. if you can fixed my problem so thanks send my
how to get the anchor field in hidden field tag
how to get the anchor field in hidden field tag  I have a following code I need to have the value of property "emp" in a hidden field also. when i try to put the following code, I cant get the hidden tag when i see the source
HTML file upload example
HTML file upload example Here is an example of File Upload in html... of a text field and a value set by a script In this example we have shown three...;<center><font size=4><b>File Upload in HTML</b><
retrieve in xml file in struts2
retrieve in xml file in struts2  i am using struts2 and trying... can i get back the value from the xml file in the ajax function and print... properties file using ajax. i now put the values from properties file to map
spring form field clearence
spring form field clearence  hi, I have spring form application in which i have security question and answer field for answer field validation after giving wrong format validation occurs but the field remains in that text field
form field issue
form field issue  how to set the values in form field and form field drop down (doc 2007) using Apache poi
File Upload
File Upload  when i execute the image upload to mysql database it shows an exception that file path cannot be found
form based file upload using servlets
form based file upload using servlets  Hai all, I wrote a program to upload a file into specified directory and store the file path and username... file path it uploaded successfully but in database table it gives null value
ModuleNotFoundError: No module named 'field'
ModuleNotFoundError: No module named 'field'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'field' How to remove the ModuleNotFoundError: No module named 'field'
Retrive only requird data from a table in MYSQL databade to JSP file..on a field submit button.
Retrive only requird data from a table in MYSQL databade to JSP file..on a field submit button.  i have MYSQL DB,DB NAME:TRLIST, TABLE NAME:TR_LIST; (FIELD NAMES:NODE,PACKAGE,TR), {VALUES:Row1(CCN,CS4.0,XXX),Row2(SDP,CS5.0,YYY
converting field to text sql
converting field to text sql  I wanted to convert the field to TEXT in SQL.. is it possible?   SQL - Converting the field to TEXT works... the field to TEXT works SELECT CONVERT(TEXT,fld_name) FROM TABLE_NAME
Upload file without brouse button
Upload file without brouse button  Hi i want to upload 7 files... the files (.jpeg) .But I am not able to enter that address into file field can any body help me .I am using FormFile API to upload files.I dont want to change my

Ads