gpt4 book ai didi

java - Primefaces 对话框将标题和内容显示为网页中的文本

转载 作者:行者123 更新时间:2023-11-30 05:40:11 24 4
gpt4 key购买 nike

我是 Primefaces 新手,目前使用 primefaces 6.0,我正在尝试运行 primefaces 官方网站上的在线示例。

该示例演示了对话框的使用,我按照在示例中看到的方式进行操作,但是我观察到页面显示对话框标签标题属性的值,后跟对话框的内容作为文本

我希望有人告诉我我做错了什么,请参阅我的 View 中的以下代码和结果页面的屏幕截图

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">




<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">

<h:panelGrid columns="1" cellpadding="5">

<p:commandButton value="Basic" type="button" onclick="PF('dlg1').show();"
/>

<p:commandButton value="Modal" type="button" onclick="PF('dlg2').show();" />

<p:commandButton value="Effects" type="button" onclick="PF('dlg3').show();" />

</h:panelGrid>


<p:dialog header="Basic Dialog" widgetVar="dlg1" minHeight="40">
<h:outputText value="Resistance to PrimeFaces is futile!" />
</p:dialog>


<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true"
height="100">
<h:outputText value="This is a Modal Dialog." />
</p:dialog>


<p:dialog header="Effects" widgetVar="dlg3" showEffect="explode"
hideEffect="bounce" height="100">
<h:outputText value="This dialog has nice effects." />
</p:dialog>
</html>

enter image description here

最佳答案

您的页面中必须有 h:head 标记。

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>

http://primefaces.org/faq.html

关于java - Primefaces 对话框将标题和内容显示为网页中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55809490/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com