究竟是什么process
,并update
在PrimeFaces p:commandXxx
组件和execute
和render
的f:ajax
标签?
哪个在验证时有效?什么是update
属性做,而不是更新的值从后端组件?不要process
属性绑定值模型?究竟是什么@this
,@parent
,@all
并@form
在这两个属性?
下面的例子工作正常,但我对基本概念有点困惑.
<p:commandButton process="@parent"
update="@form"
action="#{bean.submit}"
value="Submit" />
Run Code Online (Sandbox Code Playgroud) 我正在使用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.
谢谢
我创建了表单,我希望在新表创建时在表上显示以前的现有项目.我希望在填写表格时显示匹配的项目.但是当我尝试在没有完成表单的情况下过滤列表时,会出现验证消息,并且表格不会更新.
不知道是否可能,但我想做的事情是这样的:
<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的新手.