0

サイトの部分的な更新後に消える fileUploader があります

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:c="http://java.sun.com/jsp/jstl/core"
                xmlns:forgeview="http://jboss.org/forge/view"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j" xmlns:p="http://primefaces.org/ui"
                template="/resources/scaffold/pageTemplate.xhtml">

    <f:metadata>
        <f:viewParam name="id" value="#{gameBean.id}"/>
        <f:event type="preRenderView" listener="#{gameBean.retrieve}"/>
    </f:metadata>

    <ui:param name="pageTitle" value="Create Game"/>

    <ui:define name="header">
        Game
    </ui:define>

    <ui:define name="subheader">
        <c:choose>
            <c:when test="#{!empty gameBean.id}">
                Bearbeiten eines Spiels
            </c:when>
            <c:otherwise>
                Hinzufügen eines neuen Spiels
            </c:otherwise>
        </c:choose>
    </ui:define>

    <ui:define name="footer"/>

    <ui:define name="main">

        <h:form id="create" enctype="multipart/form-data">
            <h:messages globalOnly="true" styleClass="error"/>

            <h:panelGrid id="grid" columnClasses="label,component,required" columns="3">
                <h:outputLabel for="gameBeanGameName" value="Name:"/>
                <h:panelGroup>
                    <h:inputText id="gameBeanGameName" value="#{gameBean.game.name}"/>
                    <h:message for="gameBeanGameName" styleClass="error"/>
                </h:panelGroup>
                <h:outputText/>
                <h:outputLabel for="gameBeanGameType" value="Typ: "/>
                <h:panelGroup>
                    <p:selectOneMenu id="gameBeanGameType" value="#{gameBean.game.type}">
                        <f:selectItems value="#{gameBean.types}"/>
                    </p:selectOneMenu>

                </h:panelGroup>
                <h:outputText/>
                <h:outputLabel rendered="#{fileUploadBean.size > 0}" for="cover"/>
                <a4j:mediaOutput rendered="#{fileUploadBean.size > 0}" element="img" mimeType="#{file.mime}" id="cover"
                                 createContent="#{fileUploadBean.paint}"
                                 style="width:100px; height:100px;" cacheable="false">
                </a4j:mediaOutput>
                <h:outputText />
                <h:outputLabel for="gameBeanGameCover"/>
                <h:panelGroup>
                    <h:form enctype="multipart/form-data">
                    <p:fileUpload auto="true"  id="gameBeanGameCover" update="@all" fileUploadListener="#{fileUploadBean.listener}"
                                  mode="advanced" allowTypes="/(\.|\/)(gif|jpe?g|png)$"/>
                    </h:form>
                </h:panelGroup>
                <h:outputText />
                <h:outputLabel for="gameBeanGameTrailer" value="TrailerURL:"/>
                <h:panelGroup>
                    <h:inputText id="gameBeanGameTrailer" value="#{gameBean.game.trailer}"/>
                    <h:message for="gameBeanGameTrailer" styleClass="error"/>
                </h:panelGroup>
                <h:outputText/>

                <h:outputLabel for="gameBeanGameDescription" value="Beschreibung:"/>
                <h:panelGroup>
                    <h:inputTextarea id="gameBeanGameDescription" value="#{gameBean.game.description}"/>
                    <h:message for="gameBeanGameDescription" styleClass="error"/>
                </h:panelGroup>
                <h:outputText/>




                <h:panelGroup>

                </h:panelGroup>


            </h:panelGrid>

            <h3>Cover:</h3>



            <div class="buttons">
                <h:commandLink value="Speichern" action="#{gameBean.update}" styleClass="btn btn-primary"/>
                <c:choose>
                    <c:when test="#{!empty gameBean.id}">
                        <h:link value="Abbrechen" outcome="view" styleClass="btn btn-primary">
                            <f:param name="id" value="#{gameBean.id}"/>
                        </h:link>
                        <h:commandLink value="Löschen" action="#{gameBean.delete}" styleClass="btn btn-primary"/>
                    </c:when>
                    <c:otherwise>
                        <h:link value="Abbrechen" outcome="search" styleClass="btn btn-primary"/>
                    </c:otherwise>
                </c:choose>
            </div>

            <p:fileUpload fileUploadListener="#{fileUploadBean.listener}"
                          mode="advanced"
                          auto="true"
                          id="uploader"
                          update=":create, uploader"
                          sizeLimit="100000"
                          multiple="true"
                          allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
        </h:form>
    </ui:define>

</ui:composition>
4

1 に答える 1