Java 如何在PrimeFaces layoutUnit中更新表单
我想使用primefaceJava 如何在PrimeFaces layoutUnit中更新表单,java,jsf,primefaces,Java,Jsf,Primefaces,我想使用primeface创建两个s。单击菜单上的项目时,可在菜单的西边,在中央显示页面。 因为必须包装在中,所以我的内容在中心,因为我需要使用表格来显示数据。因此,我的xhtml页面如下所示: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtm
创建两个
s。单击菜单上的项目时,可在菜单的西边
,在中央
显示页面。
因为
必须包装在
中,所以我的内容在中心,因为我需要使用表格来显示数据。因此,我的xhtml页面如下所示:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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:ui="http://java.sun.com/jsf/facelets"
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>PrimeFaces</title>
</f:facet>
</h:head>
<h:body>
<p:layout fullPage="true">
<p:layoutUnit position="west" size="175" header="Left" collapsible="true">
<p:menu>
<p:submenu label="testUpdate">
<p:menuitem value="open" id="open" actionListener="#{backingBean.open()}" update=":center_form"/>
<p:menuitem value="close" id="close" actionListener="#{backingBean.close()}" update=":center_form"/>
</p:submenu>
</p:menu>
</p:layoutUnit>
<p:layoutUnit position="center">
<p:panel id="center_panel" rendered="#{backingBean.render}">
<h:form id="center_form">
testing
</h:form>
</p:panel>
</p:layoutUnit>
</p:layout>
</h:body>
</f:view>
</html>
素面
测试
和my web.xml:
javax.faces.PROJECT_阶段
发展
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
/面孔/*
30
faces/index.xhtml
问题是,当我单击“打开”和“关闭”时,ajax似乎无法正常工作,我必须通过手动重新加载页面来刷新连接,以使页面更新
我可以知道这是否可能做到吗?
如果是这样的话,我的代码中有什么错误吗?
或者,当我单击菜单上的项目时,如何让中心布局单元自动更新?将其添加到web.xml:
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
org.apache.myfaces.webapp.StartupServletContextListener
请尝试
update=“@all”
您应该使用h:head
来包含用于ajax的jsf库。告诉我它是否有效!这不是问题,因为我只是给出了我的部分代码。。。否则,页面无法正常启动,而不仅仅是更新问题。。很抱歉。。我将在以后粘贴我的完整代码。您的web.xml是需要的。我现在在外面,我将在今晚更新我的代码和web.xml。它不工作。我甚至无法在添加侦听器后构建。首先,我使用的是Primefaces,但不是myfaces。其次,请检查:(),@all不受Primefaces支持