简体   繁体   English

JSF / XHTML-一个xhtml页面,其中两次包含相同的xhtml页面

[英]JSF/XHTML - one xhtml page which includes the same xhtml page twice

I got a xhtml page with a sessionscoped bean. 我有一个带有sessionscoped bean的xhtml页面。 Now I want to use this page twice in another html page, one on the left side and 1 on the right side of the screen. 现在,我想在另一个HTML页面中两次使用此页面,一个在屏幕的左侧,一个在屏幕的右侧。 If I include it, it refers to the same bean, how can i make them independent, without writing the html with a different bean? 如果我包含它,它指向的是同一个bean,如何在不使用其他bean编写html的情况下使它们独立?

You need to use tags to apply this concept. 您需要使用标签来应用此概念。 You can create your own tags and add them in your xhtml page taglib 您可以创建自己的标签并将其添加到您的xhtml页面taglib中

            <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">

Then you should use your implemented page twice in html as you expected. 然后,您应该按预期使用html中的已实现页面两次。 To do this, you can create two divs horizontally and use this taglib on both divs. 为此,您可以水平创建两个div,并在两个div上都使用此taglib。

                        <div class="box1">
                            <clrp:userlist />
                        </div>
                        <div class="box2">
                            <clrp:userlist />
                        </div>

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM