• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

file uploading Problem in Struts

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
}

}



 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic