我得到了一个带有 session 范围 bean 的 xhtml 页面。现在我想在另一个 html 页面中两次使用此页面,一次在屏幕左侧,一次在屏幕右侧。如果我包含它,它指的是同一个 bean,我怎样才能使它们独立,而不用用不同的 bean 编写 html?
最佳答案
你需要使用标签来应用这个概念。您可以创建自己的标签并将它们添加到您的 xhtml 页面标签库中
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:taglibname="http://panorosys.com/products/taglibname/taglib"
template="/WEB-INF/templates/clrp-template.xhtml">
那么您应该按预期在 html 中使用您实现的页面两次。为此,您可以水平创建两个 div,并在两个 div 上使用此标签库。
<div class="box1">
<clrp:userlist />
</div>
<div class="box2">
<clrp:userlist />
</div>
希望这对您有所帮助。
关于java - JSF/XHTML - 一个包含相同 xhtml 页面两次的 xhtml 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23466541/