验证错误问题

jsf_jiaozi 2011-12-23
我使用icefaces的组件上传图片出现验证错误

<h:form id="edit" enctype="multipart/form-data">
        <h:panelGroup >
        <h:panelGrid columns="2">
        图片名称:
        <ice:inputText value="#{up.ptname}"></ice:inputText>
        图片分类:
        <h:selectOneMenu value="#{up.classes}" required="true">
        <f:selectItems value="#{up.list}"/>
        </h:selectOneMenu>
        </h:panelGrid>
        <h:panelGrid columns="2">
        上传图片:
<ace:fileEntry id="fileEntryComp"
               label="File Entry"
               relativePath="uploaded"
               fileEntryListener="#{up.listener}"/>
            </h:panelGrid>
</h:panelGroup>
<h:commandButton value="确定" action="#{up.listener}"></h:commandButton>
        </h:form>
jsf_jiaozi 2011-12-23
bean文件
public void listener(FileEntryEvent event) {

    FileEntry fileEntry = (FileEntry) event.getSource();
    FileEntryResults results = fileEntry.getResults();
    for (FileEntryResults.FileInfo fileInfo : results.getFiles()) {
        if (fileInfo.isSaved()) {
            // Process the file. Only save cloned copies of results or fileInfo
       // System.out.println(fileInfo);
        String a=fileInfo.getFile().toString();
        photo pt = new photo();
        pt.setPath(a);
        pt.setPtname(ptname);
        //pt.setClasses(classes);
DAO.Upload.upload(pt);
System.out.println(ptname);
        }
    }
}
Global site tag (gtag.js) - Google Analytics