2014-03-26 4 views
0

Im은 Primefaces4.0을 JSF2.0과 함께 사용하여 Primeface의 기본 사항을 알고 있습니다. 나를 위해 p:fileUpload가 작동하지 않습니다. 이전에 작동했습니다. 무슨 일이 생기는지 모르겠다 파일 선택기에서 파일을 선택할 때 p : fileUpload의 파일 팬에 채워진 파일이 없습니다.Primefaces p : fileUpload가 작동하지 않습니다.

<p:panel style="font-size:15px;" header="Upload"> 
    <p:fileUpload fileUploadListener="#{addAgentxls.handleFileUpload}" mode="advanced" dragDropSupport="true" 
        update="messages status" sizeLimit="100000" style="font-size:12px;" /> 
    <p:growl id="messages" showDetail="true"/> 
    <p:outputLabel id="status" style="font-size:13px;" value="#{addAgentxls.status }"/> 
</p:panel> 

클래스 파일 :

@ManagedBean(name = "addAgentxls", eager = true) 
@SessionScoped 
public class AddAgentUsingXLS { 
    public AddAgentUsingXLS(){ 
    } 
    public void handleFileUpload(FileUploadEvent event) { 
      FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded."); 
      FacesContext.getCurrentInstance().addMessage(null, msg); 
     } 
} 

의 web.xml :

<!-- File Uploading Constraints --> 
<filter> 
    <filter-name>PrimeFaces FileUpload Filter</filter-name> 
    <filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>PrimeFaces FileUpload Filter</filter-name> 
    <servlet-name>Faces Servlet</servlet-name> 
</filter-mapping> 

나는 또한 오류가 발생 나를 위해 This 수행 아무것도 볼 여기

내 코드입니다 Google 크롬 브라우저

Uncaught TypeError: Object [object Object] has no method 'fileupload' 
fileupload.js.xhtml?ln=primefaces&v=4.0:1 

아무 가치가 없나요?

+0

양식에 enctype = "multipart/form-data"를 추가했는지 확실하지 않습니다. – psi

+0

그래도 패널이 h로 추가됩니다. 양식 – Sarz

+1

참조 http://stackoverflow.com/questions/16166039/uncaught-typeerror-cannot-read-property-value-of-undefined-using-primefaces-f/16168985#16168985 – psi

답변

1

해결! 내가 jQuery.js의 최신 버전을 사용하여 Primefaces

0

다음 스택 오버플로 링크에 대한 제안을 고려하십시오.

In JavaScript can I make a "click" event fire programmatically for a file input element?

같은 문제를 해결합니다. jQuery (".primeFacesHiddenAwayButton type = [ 'file']"). click()은 IE뿐만 아니라 firefox에서도 잘 작동합니다. (Firefox는 Selenium 드라이버 제약으로 인해 최신 버전이 아닙니다.) 어쨌든, 크롬에서는 JS 버튼이 작동하지 않습니다. 이것은 분명히 브라우저에 내장 된 보안 기능입니다. 제공된 링크에서 제안을 시도 할 수 있습니다.

관련 문제