Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf PrimeFaces的文件上载在动态加载的页面中不起作用_Jsf_Primefaces_Jsf 2.2_Java Ee 7 - Fatal编程技术网

Jsf PrimeFaces的文件上载在动态加载的页面中不起作用

Jsf PrimeFaces的文件上载在动态加载的页面中不起作用,jsf,primefaces,jsf-2.2,java-ee-7,Jsf,Primefaces,Jsf 2.2,Java Ee 7,当我在标准页面中使用primefaces文件上传时,一切正常。但是,如果将其添加到包含的页面文件上载事件中,则不会调用 `<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com

当我在标准页面中使用primefaces文件上传时,一切正常。但是,如果将其添加到包含的页面文件上载事件中,则不会调用

`<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>EMR</title>
            </f:facet>

            <style type="text/css">      

            </style>
            <script type='text/javascript' src="">
            </script> 

        </h:head>
        <h:body>
            <p:layout fullPage="true" id="p_layoutid" style="border:0px;">

                <p:layoutUnit position="north" id="top" size="65" collapsible="true" gutter="0" style="border:0px;">
                    <h:form id="frmtheme">                        
                        <p:themeSwitcher effectSpeed="normal" effect="fold" style="width:160px;" 
                                         id="defaultSwitcher" value="#{themeSwitcherView.themeName}">

                            <f:selectItem itemLabel="Choose Theme" itemValue="" />
                            <f:selectItems value="#{themeSwitcherView.themes}" />        
                            <p:ajax global="false" listener="#{themeSwitcherView.saveTheme}" />

                        </p:themeSwitcher>
                    </h:form>   

                </p:layoutUnit>

                <p:layoutUnit position="west" size="300" collapsible="true" gutter="0" style="border:0px;">
                    <h:form id="frmtree"  >
                        <p:growl id="messages" showDetail="true" />  
                        <p:tree value="#{treeBean.root}" var="node"   style="border:0px;"
                                selectionMode="single"  selection="#{treeBean.selectedNode}" id="tree"

                                >  

                            <p:ajax event="expand" update=":frmtree:messages" listener="#{treeBean.onNodeExpand}" />  
                            <p:ajax event="collapse" update=":frmtree:messages" listener="#{treeBean.onNodeCollapse}" />  

                            <p:ajax event="select" update=":centerContentPanel" listener="#{treeBean.onNodeSelect}"  />  
                            <p:ajax event="unselect" update=":frmtree:messages" listener="#{treeBean.onNodeUnselect}" />  

                            <p:treeNode>  
                                <h:outputText value="#{node}" />
                            </p:treeNode>  
                        </p:tree>                        
                    </h:form>
                </p:layoutUnit>
                <p:layoutUnit id="cent" position="center"
                              resizable="true" closable="true" collapsible="true" style="border:0px;">

                    <h:panelGroup id="centerContentPanel" rendered="true" >  
                        <ui:include id="maincontent"  src="#{treeBean.pageName}" ></ui:include>                    
                    </h:panelGroup>

                </p:layoutUnit>

            </p:layout>
        </h:body>
    </f:view>
</html>`
`
电子病历
`
动态包含的页面加载到树节点点击如下

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    >
    <h:form id="upForm" target="_blank" >   

        <p:fileUpload fileUploadListener="#{fileUp.handleFileUpload}" 
                      mode="advanced"
                      update="messagesup"
                      multiple="true"

                      sizeLimit="20971520"
                      label="Select File"
                      allowTypes="/(\.|\/)(gif|jpe?g|png|pdf|doc?x)$/"/>
        <p:growl id="messagesup" showDetail="true"/>  



    </h:form>
</ui:composition>


“出了点问题。”然后呢?请详细说明“不工作”的原因。在树节点上,单击加载了包含fileupload组件的页面的中心布局单元。它可以完美地浏览文件,但当我点击upload按钮时,什么也没有发生,事实上bean从不调用排除一个和另一个,如果包含一个常规命令按钮,它是否调用backingBean方法?如果不是,则这与文件上载没有具体关系。这两个副本中的一个必须进一步帮助您:或者请查看上面的代码块,当我在独立页面中添加文件上载组件时,它工作得非常好,但是,当我将它包含在ui:composition中时,bean甚至从未启动。@BalusC you's right我试图在包含的页面中添加一个命令按钮,但它也没有调用bean。请告诉我这个错误。我在左侧布局单元中有p:tree,我想在单击树节点时在中心布局中加载文件上载页面