У меня проблема с загрузкой файлов в стойках
мой код файла jsp
Имя кандидата
Кандидат Текущее обозначение
Кандидат Тотальный Опыт
Текущая зарплата
ожидаемая зарплата
готов к переезду
Образование
</tr>
<tr>
<td>Key Skill In Field<br /></td>
<td><html:text name="GenerateResumeForm" size="35" property="keySkill"/></td>
</tr>
<tr>
<td>Attach Resume<br /></td>
<td><html:file name="GenerateResumeForm" property="attachFile"/></td>
</tr>
<tr>
<td>Job Description<br /></td>
<td><html:textarea name="GenerateResumeForm" cols="27" rows="5" property="jobDesc"/></td>
</tr>
<tr>
<td><br /></td>
<td><html:submit/></td>
</tr>
</table>
</html:form>
моя ActionForm - это
пакет com.hrstrides.employer.generateResume;
import org.apache.struts.upload.FormFile;
открытый класс GenerateResumeForm расширяет 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;
private String readyToRelocate;
private String education;
private String keySkill;
private FormFile attachFile;
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 candidateName;
}
, а класс действий
пакет 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;
открытый класс 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;
}
}
и ошибка типа
java.lang.IllegalArgumentException: несоответствие типа аргумента в sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод) в sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)java.lang.reflect.Method.invoke (Method.java:597) в org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod (PropertyUtilsBean.java:1773) в org.apache.commons.beanutils.PropertyUtilsBileanJava: 1759) в org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty (PropertyUtilsBean.java:1648) в org.apache.commons.beanutils.PropertyUtilsBean.setProperty (PropertyUtilsBean.java:16aps.u.yava.16aps). org.BeanUtilsBean.setProperty (BeanUtilsBean.java:1022) в org.apache.commons.beanutils.BeanUtilsBean.populate (BeanUtilsBean.java:811) в org.apache.commons.beanutils.BeanUtils.populate (BeanUtils.java:298) в org.apache.struts.util.RequestUtils.populate (RequestUtils.java:49)org.apache.struts.action.RequestProcessor.processPopulate (RequestProcessor.java:816) в org.apache.struts.action.RequestProcessor.process (RequestProcessor.java:203) в org.apache.struts.action.ActionServlet.process (ActionServlet.java:1196) в org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:432) в javax.servlet.http.HttpServlet.service (HttpServlet.java:710) в javax.servlet.ttlet.http..service (HttpServlet.java:803) в org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290) в org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilg.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:230)в org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:175)
в org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:128)
в org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:104)
в org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109)
в org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:261)
в org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:844)
в org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process (Http11Protocol.java:581)
в org.apache.tomcat.util.net.JIoEndpoint $ Worker.run (JIoEndpoint.java:447)
at java.lang.Thread.run (Thread.java:619)