File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes file uploading Problem in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "file uploading Problem in Struts" Watch "file uploading Problem in Struts" New topic

file uploading Problem in Struts

nayan rami
Ranch Hand

Joined: Dec 28, 2010
Posts: 30
i have problem with the file uploading in struts it will give and error like -argument type mismatch this is my Action Form


package com.hrstrides.employer.generateResume;

import org.apache.struts.upload.FormFile;

public class GenerateResumeForm extends org.apache.struts.action.ActionForm {

private static final long serialVersionUID = 6895513074470145219L;

private String designation;
private String experiance;
private String jobDesc;
private String currentSalary;
private String expectedSalary;

public String getDesignation() {
return designation;
public void setDesignation(String designation) {
this.designation = designation;
public String getExperiance() {
return experiance;
public void setExperiance(String experiance) {
this.experiance = experiance;
public String getJobDesc() {
return jobDesc;
public void setJobDesc(String jobDesc) {
this.jobDesc = jobDesc;
public String getCurrentSalary() {
return currentSalary;
public void setCurrentSalary(String currentSalary) {
this.currentSalary = currentSalary;
public String getExpectedSalary() {
return expectedSalary;
public void setExpectedSalary(String expectedSalary) {
this.expectedSalary = expectedSalary;
public String getReadyToRelocate() {
return readyToRelocate;
public void setReadyToRelocate(String readyToRelocate) {
this.readyToRelocate = readyToRelocate;
public String getEducation() {
return education;
public void setEducation(String education) { = education;
public String getKeySkill() {
return keySkill;
public void setKeySkill(String keySkill) {
this.keySkill = keySkill;
public FormFile getAttachFile() {
return attachFile;
public void setAttachFile(FormFile attachFile) {
this.attachFile = attachFile;
public String getCandidateName() {
return candidateName;
public void setCandidateName(String candidateName) {
this.candidateName = candidateName;
public static long getSerialversionuid() {
return serialVersionUID;
private String readyToRelocate;
private String education;
private String keySkill;
private FormFile attachFile;
private String candidateName;


Action Form

package com.hrstrides.employer.generateResume;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

public class GenerateResumeAction extends Action {

private String name;
private String designation;
private String experiance;
private String currentSalary;
private String expectedSalary;
private String relocate;
private String education;
private String keySkill;
private FormFile file;
private String jobDescription;

public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse responese)throws Exception{

GenerateResumeForm generateResume = (GenerateResumeForm) form;

name = generateResume.getCandidateName();
designation = generateResume.getDesignation();
experiance = generateResume.getExperiance();
currentSalary = generateResume.getCurrentSalary();
expectedSalary = generateResume.getExpectedSalary();
relocate = generateResume.getReadyToRelocate();
education = generateResume.getEducation();
keySkill = generateResume.getKeySkill();

jobDescription = generateResume.getJobDesc();

FormFile myFile = generateResume.getAttachFile();

GenereateResumeDAO geneResume = new GenereateResumeDAO(name,designation,experiance,
if (geneResume.isGenerated()){

return null;


I agree. Here's the link:
subject: file uploading Problem in Struts
It's not a secret anymore!