簡體   English   中英

PrimeFaces移動提交無法正常工作

[英]PrimeFaces mobile submit not working

我將primfaces mobile用於一個非常簡單的用例,下面的代碼

 <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:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile">
    <f:view renderKitId="PRIMEFACES_MOBILE" contentType="text/html">
    <h:head></h:head>
    <h:body>

         <h:form id="f1" action="">
         <h:messages id="m1"/>
            <pm:field id="f3">
                <p:outputLabel for="name" value="Name:" id="ol1"/>
                <p:inputText id="name" value="#{search.name}"/>
            </pm:field>
            <pm:field id="f2">
                <p:outputLabel for="id" value="Id:" id="ol2"/>
                <p:inputText id="id" value="#{search.id}" />
            </pm:field>

          <p:dataList id="resultList"  value="#{search.result}" var="ctr">
    <h:outputText value="#{ctr.name}, #{ctr.id}" id="ot1"/>
</p:dataList>
 <p:commandButton value="Non-Ajax Submit" id="nonAjax" action="#{search.getResults}" ajax="false" /> 
</h:form>
    </h:body>
</f:view>
</html>

如果我刪除

    <f:view renderKitId="PRIMEFACES_MOBILE" contentType="text/html">

一切正常。 如果我灌輸它,則不會提交內容,也不會調用方法search.getResults

有任何想法嗎?

謝謝

Edit1:僅當您在開發移動應用程序時

您是否嘗試過在faces-config.xml而不是在頁面上聲明移動渲染工具包?

<application>
   <default-render-kit-id>PRIMEFACES_MOBILE</application>
</application>

編輯2:

根據文檔,這應該起作用:

<f:view renderKitId="PRIMEFACES_MOBILE" />

這意味着沒有contentType 我不知道這是否可能是一個問題。

如果您正在使用導航,請不要忘記在faces-config.xml聲明一個導航處理程序。

<application>
   <navigation-handler>
      org.primefaces.mobile.application.MobileNavigationHandler
   </navigation-handler>
</application>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM