2011-07-05 10 views
0

ファイルの候補者のStrutsの私は、支柱内のファイルのアップロードに問題があるのアップロード問題

私のJSPファイルのコード


名前
候補者の現在の名称

候補合計実務経験

現在の給与

Excpected給与



教育を再配置する準備ができて

     </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アクション{

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.DelegatingMethodAccessorImpl.invokeでsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) (DelegatingMethodAccessorImpl.java:25)でsun.reflect.NativeMethodAccessorImpl.invoke0での引数の型の不一致 (ネイティブメソッド) at java.lang.reflect.Mavod.invoke(Method.java:597) at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773) at org.apache.commons.beanutils.PropertyUtilsBean。 org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)でorg.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648) でsetSimpleProperty(PropertyUtilsBean.java:1759) at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022) at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) at org.apache.commons.beanutils。 (RequestProcessor.java:816)。 (org.apache.struts.action.RequestProcessor.process)(RequestProcessor.java:203) ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.se org.apache.catalina.core.ApplicationFilterChain.doFilterでorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) でrvlet.http.HttpServlet.service(HttpServlet.java:803) (ApplicationFilterChain。 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache。 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) (org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve。))でを参照してください。 java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter .java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:581) at orgあなたのHTML内java.lang.Thread.runで.apache.tomcat.util.net.JIoEndpoint $ Worker.run(JIoEndpoint.java:447) (Thread.java:619)

答えて

2

:formタグはenctype属性を追加しますこのように:

<html:form enctype="multipart/form-data"></html:form>