同一页面中的更新面板jsf

同一页面中的更新面板jsf,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,嗨,我正在用primefaces 5开发一个文档管理系统。y制作了一个搜索功能,搜索按钮位于左侧菜单的模板中,搜索结果显示在中心单元布局中。如果我搜索,搜索功能运行良好,但是当我搜索结果并再次尝试搜索时,结果不会刷新 我的模板文件 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <h

嗨,我正在用primefaces 5开发一个文档管理系统。y制作了一个搜索功能,搜索按钮位于左侧菜单的模板中,搜索结果显示在中心单元布局中。如果我搜索,搜索功能运行良好,但是当我搜索结果并再次尝试搜索时,结果不会刷新

我的模板文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
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>Sysged</title>
            response.setHeader("Content-Disposition", "inline");
        </f:facet>
    </h:head>

    <h:body>

        <p:layout fullPage="true">

            <p:layoutUnit position="north" size="100" resizable="true" closable="true"collapsible="true">     
                <h:graphicImage library="images" name="logo.png" ></h:graphicImage>
                 <h:graphicImage library="images" name="footer.jpg" ></h:graphicImage>
            </p:layoutUnit>



            <p:layoutUnit position="west" size="270" header="Main menu"   collapsible="true" resizable="true">
            <h:form>
            <p:menu>

                <p:submenu label="Import">
                    <p:menuitem value="Local" icon="ui-icon-disk"   url="UIlocalImport.xhtml"/>
                    <p:menuitem value="URL" icon="ui-icon-arrowrefresh-1-w"
                        url="UIlurlImport.xhtml" />
                </p:submenu>
                <p:submenu label="Search">
                    <p:menuitem>
                        <h:panelGrid columns="3" cellpadding="5"
                            style="margin-bottom:10px">

                            <p:inputText id="paramSearch" value="# {documentBean.paramSearch}"
                                required="true" label="Keyword"  />
                            <p:watermark for="paramSearch" value="Search with a keyword"
                                id="watermark" />
                        </h:panelGrid>

                        <p:commandButton action="#{documentBean.search2}"  value="Search"  update=":content"/>

                    </p:menuitem>

                </p:submenu>



                <p:submenu label="Administrator">
                    <p:menuitem value="Category manager" url="UIadminCategories.xhtml">
                    </p:menuitem>

                    <p:submenu label="Close sesion">
                        <p:menuitem>
                            <p:commandButton action="#{userBean.logout}" value="exit"
                                icon="ui-icon-close" />
                        </p:menuitem>
                    </p:submenu>

                </p:submenu>

            </p:menu>
            </h:form>
            </p:layoutUnit>

            <p:layoutUnit position="center">
            <h:panelGroup id="content" >
                <ui:insert  name="UIlocalImport" ></ui:insert>

                <ui:insert name="Uisearch"></ui:insert>
                <ui:insert name="UiadminCategories"></ui:insert>
                <ui:insert name="UIlurlImport"></ui:insert>
                </h:panelGroup>
            </p:layoutUnit>

        </p:layout>

    </h:body>

   </f:view>
 </html>

提前感谢您的时间和提问者使用行动方法的重定向:

return "UIsearch?faces-redirect=true"; 

我不知道它为什么会工作,但我猜是浏览器正在缓存页面,现在被迫重新加载。

我不确定我是否理解你的意思,但控制台没有显示任何错误没有人控制台没有显示错误。我知道我有一个jsf错误,但不知道为什么会有这样的行为。你是正确的。这是一个粘贴错误,我正在编辑这个问题,以解决这个人的工作!!太好了
<ui:define name="Uisearch">
    <h:outputScript library="js" name="pdfobject.js" target="head" />
    <h:panelGrid columns="1" cellpadding="2">

        <p:panel id="panelResults" header="Results">

            <p:dataList value="#{documentBean.documentsMatched}" var="document"
                type="definition">

                <h:outputLink value="file/#{document.pdfPath}" target="_blank">view  document</h:outputLink>   
                <div id="pdf2">
                    <object data='file/#{document.pdfPath}' type='application/pdf'
                        width='1000px' height='400px'>

                        <p>
                            It appears your Web browser is not configured to display  PDF
                            files. No worries, just <a href='file/#  document.pdfPath}'>click
                                here to download the PDF file.</a>
                        </p>

                    </object>
                </div>


            </p:dataList>

         </p:panel>

     </h:panelGrid>

  </ui:define>

</ui:composition>
    public String search2()
 {
    System.out.println("searching "+ paramSearch);

    DocumentModel doc = new DocumentModel();
    this.setDocumentsMatched(doc.searchText(this.paramSearch));
    System.out.println("search");
    return "UIsearch";

}
return "UIsearch?faces-redirect=true";