This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "file uploading Problem in Struts" Watch "file uploading Problem in Struts" New topic
Author

file uploading Problem in Struts

nayan rami
Ranch Hand

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


ActionForm


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) {
this.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 java.io.File;
import java.io.InputStream;

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();
System.out.println(myFile.getFileSize());

GenereateResumeDAO geneResume = new GenereateResumeDAO(name,designation,experiance,
currentSalary,expectedSalary,relocate,education,keySkill,jobDescription);
if (geneResume.isGenerated()){
System.out.println("True");
}else{
System.out.println("False");
}

return null;
}

}



 
wood burning stoves
 
subject: file uploading Problem in Struts
 
Similar Threads
Why my action class in not executing?
File Uploading Problem - Argument miss match
FileUploading in struts
Problem with file separator
HOw to store image in struts?upload.FormFile