Web-Inf->lib has following jars :-" name="description">
Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts File Upload in struts2 - Invalid field value for field
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Mayank Batra
File Upload in struts2 - Invalid field value for field
0 Answer(s)      4 years ago
Posted in : Struts


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


Advertisement
View Answers

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
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
Advertisements
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
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
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" %>
text field
text field  How to retrieve data from text field   Hi Friend, Try the following code: import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void main
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
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 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
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
jsf text field not blank
jsf text field not blank  text field not clear in jsf onclick of reset button in my application initial value not deleted   Hello Friend, Post your code. Thanks
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
php array sort by field
php array sort by field  Array sort by field in PHP
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
the focus to the first form field
the focus to the first form field   How do I set the focus to the first form field
focus to the first form field
focus to the first form field  How do I set the focus to the first form field
focus to the first form field
focus to the first form field  How do I set the focus to the first form field
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
validate text field iPhone
validate text field iPhone  i got two different UITextfield in my iPhone application for user login. Just wondering how to validate
Auto field update
Auto field update  In my application I have a field called status which is having the 4 values like new,submitted,approved, rejected. How to set those filed in Database(MySQL), and how to auto update that field status in other
CALULATION IN TEXT FIELD
CALULATION IN TEXT FIELD  Suppose 3 text Field first amount ,second amount and third sum of these amount,this amount will appear when tab in next filed(i don't want use any type button) in java swing HOW? PLEASE HELP
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
swing text field problem
swing text field problem  I want to navigate the content of text field from one class to another and viceversa through button but when I am getting the text from first class I am getting null value.please help me..here
Validating the password field
Validating the password field  When the validate method returns back to the registration page the password field get cleared there by asking again one more time to enter the password field at the time of re-submitting the form
retrieve record from the field table
retrieve record from the field table  Hi. I have a field in database...,kanchipuram for a single record. I have to retrieve these data from the field table... values like chennai as one value, trichy as one value. and i have to show it in html
Advertisements
 

 

 

DMCA.com