PrimeFaces 2.2.1 在本地看起来与展示中不同
我在此处和此处。这些都没有回答我的问题。我还搜索了 PrimeFaces 论坛。
在 NetBeans 中设置普通 JSF 2.0 项目,我添加了 简单对话框的 Showcase 代码。
代码 (index.xhtml) 减去 xml 声明和 DOCTYPE(XHTML 1.0 Transitional):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>PrimeFaces</title>
</h:head>
<h:body>
<h:panelGrid columns="1" cellpadding="5">
<p:commandButton value="Basic" onclick="dlg1.show();" type="button"/>
<p:commandButton value="Modal" onclick="dlg2.show();" type="button"/>
<p:commandButton value="Effects" onclick="dlg3.show();" type="button"/>
</h:panelGrid>
<p:dialog header="Basic Dialog" widgetVar="dlg1">
<h:outputText value="Resistance to PrimeFaces is futile!" />
</p:dialog>
<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="200">
<h:outputText value="This is a Modal Dialog." />
</p:dialog>
<p:dialog header="Effect Dialog" widgetVar="dlg3" showEffect="bounce" hideEffect="explode" height="200">
<h:outputText value="This dialog has cool effects." />
</p:dialog>
</h:body>
我已将 aristo
主题添加到我的 Libraries
(添加到类路径的 NetBeans 方式),并将以下内容添加到 web.xml
web.xml(部分):
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
</context-param>
没有进行其他更改,尽管我快速安装/卸载了另一个主题(dark-hive)只是为了确保该主题已正确注册。结果如下:
本地(Chrome 15.0.874.92):
展示:(来自 PrimeFaces展示)
堆栈:
PrimeFaces 2.2.1
JSF 2.0
玻璃鱼3.1.1
Java 1.6.0_18
Windows 7 x64
(由 NetBeans 7.0.1 生成)
编辑:这也在 FireFox 7.0.1 和 IE 9 上进行了测试
I've seen similar questions asked here and here. Neither of these answered my question. I've also searched the PrimeFaces forum.
Setting up a vanilla JSF 2.0 project in NetBeans, I've added the Showcase code for Simple Dialog.
Code (index.xhtml) minus the xml declaration and DOCTYPE (XHTML 1.0 Transitional):
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<title>PrimeFaces</title>
</h:head>
<h:body>
<h:panelGrid columns="1" cellpadding="5">
<p:commandButton value="Basic" onclick="dlg1.show();" type="button"/>
<p:commandButton value="Modal" onclick="dlg2.show();" type="button"/>
<p:commandButton value="Effects" onclick="dlg3.show();" type="button"/>
</h:panelGrid>
<p:dialog header="Basic Dialog" widgetVar="dlg1">
<h:outputText value="Resistance to PrimeFaces is futile!" />
</p:dialog>
<p:dialog header="Modal Dialog" widgetVar="dlg2" modal="true" height="200">
<h:outputText value="This is a Modal Dialog." />
</p:dialog>
<p:dialog header="Effect Dialog" widgetVar="dlg3" showEffect="bounce" hideEffect="explode" height="200">
<h:outputText value="This dialog has cool effects." />
</p:dialog>
</h:body>
I've added the aristo
theme to my Libraries
(NetBeans way of adding to the classpath) and added the following to web.xml
web.xml (partial):
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
</context-param>
No other changes were made, although I quickly installed/uninstalled another theme (dark-hive) just to make certain that the theme was being registered properly. The results are as follows:
Local (Chrome 15.0.874.92):
Showcase: (from PrimeFaces Showcase)
Stack:
PrimeFaces 2.2.1
JSF 2.0
Glassfish 3.1.1
Java 1.6.0_18
Windows 7 x64
(Generated by NetBeans 7.0.1)
Edit: This was also tested on FireFox 7.0.1 and IE 9
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题不是默认字体大小吗?我可以从 showcase css 中看到它的自定义字体大小覆盖了主题的默认值:
我检查了我的一些项目,所有项目都有一些字体大小/字体系列自定义。希望有帮助
Isn't the problem the default font sizes? I can see from the showcase css that it has custom font sizes overriding the theme's default:
I checked some of my projects and all of them also have some font-size/font-family customization. Hope it helps
我读了你的 3 篇文章。你这里有什么问题吗?你能更具体地描述你的问题吗?我的意思是,他们有什么不同?
如果与字体大小有关,请查看 PrimeFaces 文档。 第 8.4 章:主题提示:(用户指南 3.4 及更高版本中的第 7.4 章)
主题的默认字体大小可能比预期大,需要更改 PrimeFaces 的字体大小
全局组件,使用 .ui-widget 样式类。较小字体的示例;
希望它可以帮助你:)
I read your 3 posts. What's you problem here? Can you describe you problem more specifically? I mean, how different are they?
If it about font size, check PrimeFaces' Document. At Chapter 8.4: Themeing Tips: (Chapter 7.4 in User Guide 3.4 and later)
Default font size of themes might be bigger than expected, to change the font-size of PrimeFaces
components globally, use the .ui-widget style class. An example of smaller fonts;
Hope that it can help u :)