2
我对PrimeFaces完全陌生,所以很抱歉,如果这是一个愚蠢的问题。Primefaces css missing
根据primefaces.org网站,不需要配置。您只需将primefaces jar放入您的类路径中并将该名称空间添加到该页面即可。这正是我所做的,我可以访问和创建primefaces组件,但是没有样式应用于它们。
这就是网页的源文件看起来像
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<head><title>...</title></head>
<body>
<p:accordionPanel>
<p:tab title="First Tab Title">
<h:outputText value= "Lorem"/>
</p:tab>
<p:tab title="Second Tab Title">
<h:outputText value="Ipsum" />
</p:tab>
</p:accordionPanel>
</body>
</html>
这是什么渲染
<!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">
<head><title>...</title></head>
<body><div id="j_id_3" class="ui-accordion ui-widget ui-helper-reset ui-hidden-container" role="tablist"><h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-state-active ui-corner-top" role="tab" aria-expanded="true"><span class="ui-icon ui-icon-triangle-1-s"></span><a href="#" tabindex="-1">First Tab Title</a></h3><div id="j_id_3:j_id_4" class="ui-accordion-content ui-helper-reset ui-widget-content" role="tabpanel" aria-hidden="false">Lorem</div><h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" role="tab" aria-expanded="false"><span class="ui-icon ui-icon-triangle-1-e"></span><a href="#" tabindex="-1">Second Tab Title</a></h3><div id="j_id_3:j_id_6" class="ui-accordion-content ui-helper-reset ui-widget-content ui-helper-hidden" role="tabpanel" aria-hidden="true">Ipsum</div><input type="hidden" id="j_id_3_active" name="j_id_3_active" value="0" /></div><script id="j_id_3_s" type="text/javascript"><!--
PrimeFaces.cw('AccordionPanel','widget_j_id_3',{id:'j_id_3',active:0});
//--></script>
</body>
</html>
正如你所看到的,primefaces组件呈现,附带所有的CSS样式,但有没有引用任何样式表呈现。应该自动呈现,还是我应该添加到页面?
我使用的MyFaces 2.1.5,PrimeFaces 3.5和我上运行它的Tomcat 7.0.26
非常感谢!这确实使它工作:) – Wouter 2013-04-27 13:25:25
这让我开心:) – 2013-04-27 15:52:33
很好的回答:) +1 – 2014-09-19 14:01:16