相关疑难解决方法(0)

了解PrimeFaces进程/更新和JSF f:ajax执行/呈现属性

究竟是什么process,并update在PrimeFaces p:commandXxx组件和executerenderf:ajax标签?

哪个在验证时有效?什么是update属性做,而不是更新的值从后端组件?不要process属性绑定值模型?究竟是什么@this,@parent,@all@form在这两个属性?

下面的例子工作正常,但我对基本概念有点困惑.

<p:commandButton process="@parent"
                 update="@form"
                 action="#{bean.submit}" 
                 value="Submit" />
Run Code Online (Sandbox Code Playgroud)

jsf process updates primefaces

181
推荐指数
4
解决办法
22万
查看次数

如何在JSF页面中使用<h:form>?单一形式?多种形式?嵌套表格?

我正在使用Facelet模板技术在我正在处理的JSF 2应用程序中布局我的页面.

在我的header.xhtml中,primefaces要求菜单栏包含在h:form中.

<h:form>
    <p:menubar autoSubmenuDisplay="true">
        Menu Items here!
    </p:menubar>
</h:form>
Run Code Online (Sandbox Code Playgroud)

所以,在我的内容页面中,我将有另一个h:form或更多.

如果我只是将h:form放在我的template.xhtml中,它会起作用吗?

<h:body>
    <h:form>
        <div id="top">
            <ui:insert name="header"><ui:include src="sections/header.xhtml"/></ui:insert>
        </div>
        <div>
            <div id="left">
                <ui:insert name="sidebar"><ui:include src="sections/sidebar.xhtml"/></ui:insert>
            </div>
            <div id="content" class="left_content">
                <ui:insert name="content">Content</ui:insert>
            </div>
        </div>
        <div id="bottom">
            <ui:insert name="footer"><ui:include src="sections/footer.xhtml"/></ui:insert>
        </div>
    <h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)

我实际上正在考虑一个用例,我需要在页面中使用多个h:form.

谢谢

forms jsf nested jsf-2

44
推荐指数
1
解决办法
5万
查看次数

如何让验证取决于按下的按钮?

我创建了表单,我希望在新表创建时在表上显示以前的现有项目.我希望在填写表格时显示匹配的项目.但是当我尝试在没有完成表单的情况下过滤列表时,会出现验证消息,并且表格不会更新.

不知道是否可能,但我想做的事情是这样的:

<h:form id="form">

    <h:outputText value="Name: "/>
    <p:inputText value="#{itemsBean.name}" id="name" required="true"/>
    <br/>
    <h:outputText value="Description: "/>
    <p:inputText value="#{itemsBean.description}" id="description" required="true"/>

    <p:commandButton value="Save" update="form" actionListener="#{itemsBean.save}"/> //validate and save
    <p:commandButton value="Filter" update="form" actionListener="#{itemsBean.updateItemsList}"/> //don't validate, and update the table.

    <p:dataTable id="list" value="#{itemsBean.itemsList}" var="item">     
        <p:column>
            <h:outputText value="#{item.name}"/>
        </p:column>
        <p:column>
            <h:outputText value="#{item.description}"/>
        </p:column>
    </p:dataTable>

</h:form>
Run Code Online (Sandbox Code Playgroud)

我是JSF的新手.

validation jsf primefaces jsf-2 commandbutton

34
推荐指数
3
解决办法
4万
查看次数

标签 统计

jsf ×3

jsf-2 ×2

primefaces ×2

commandbutton ×1

forms ×1

nested ×1

process ×1

updates ×1

validation ×1