我不能使用我自己的图标作为主要的p:commandButton.我的代码是:
<p:commandButton value="Cancel" action="#{userBb.cancel()}"
icon="ui-icon-myCancel" />
Run Code Online (Sandbox Code Playgroud)
css是:
.ui-icon-myCancel{
background-image: url(images/cancel_16.png) !important;
}
Run Code Online (Sandbox Code Playgroud)
文件夹的结构是普通的: /resources/images/cancel_16.png
结果我得到: 
当我尝试:
.ui-state-default .ui-icon .ui-icon-myCancel{
background-image: url(images/cancel_16.png) !important;
}
Run Code Online (Sandbox Code Playgroud)
我明白了:
当我看萤火虫报告时,有节跨度
<span class="ui-button-icon-left ui-icon ui-c ui-icon-myCancel"></span>
Run Code Online (Sandbox Code Playgroud)
有:
.ui-state-default .ui-icon {
background-image: url("/WarPort08_02b/javax.faces.resource/images/ui-icons_38667f_256x240.png.xhtml?ln=primefaces-aristo");
Run Code Online (Sandbox Code Playgroud)
我看过这个解释,其他人却没有找到答案.
当我尝试p:commandLink with h:graphicImage图标是可见的,但它是一个图像作为按钮/链接.
我的应用程序出现了奇怪的行为.命令按钮开始在第二次命中时调用操作.首先 - 什么都没发生.它对firefox和chrome有效,但在顿悟中照常工作.
我的环境: - ubuntu 11.04 - glassfish 3.1.1 - jsf 2.X - primefaces 3.2 - firefox 12.0 - 顿悟2.30.6
代码示例:
<ui:define name="content">
<h:form id="form">
<h:panelGrid id="panelGrid" columns="3">
<h:outputText value="#{msg.fieUserName}:"/>
<h:inputText id="name" value="#{userBb.editedUser.username}" />
<h:message for="name" styleClass="error_msg"/>
<h:outputText value="#{msg.fieUserDescription}:"/>
<h:inputText id="description" value="#{userBb.editedUser.description}" />
<h:message for="description" styleClass="error_msg"/>
<h:outputText value="#{msg.fieUserPassword}:"/>
<h:inputSecret id="password" value="#{userBb.editedUser.password}" redisplay="true"/>
<h:message for="password" styleClass="error_msg"/>
<h:outputText value="#{msg.fieUserRights}:"/>
<p:selectOneMenu id= "rights"
value= "#{userBb.editedUserGroup}"
converter="#{pGroupOfUsersConverter}">
<f:selectItems
value ="#{groupDao.findAll()}"
var ="row"
itemLabel="#{groupDao.rightsDescription(row.id)}"
itemValue="#{row.groupname}"
>
</f:selectItems>
</p:selectOneMenu>
<h:message for="rights" styleClass="error_msg"/>
<h:outputText value="#{msg.fiePorofolioName}:" rendered="#{userBb.chosenNew}"/> …Run Code Online (Sandbox Code Playgroud) 我有一行panelgrid作为欢迎页面的标题.它有5个元素.前两个是信息,第三个是命令链接,后两个是更改语言的命令按钮.
我想 - 把它放在一行 - 把它放在屏幕的整个宽度上; - 有两个右侧按钮与屏幕右侧对齐 - 前三个元素(单元格/列)与右侧对齐,它们之间几乎没有确定的空间.
我尝试如下:
<h:panelGrid columns="5" columnClasses="top_column1, top_column2, top_column3, top_column4, top_column5" style="width: 100%">
<h:outputText value="#{msg.LoggedAs}:" />
<h:outputText value="#{userManager.loggedUser.username} / "/>
<h:commandLink value="#{msg.butLogout}" action="#{userManager.logout()}" style="color: white" />
<h:commandButton action="#{languageOfSystem.changeLanguage('en')}" image="/resources/icons/usa_24.png" title="english" />
<h:commandButton action="#{languageOfSystem.changeLanguage('pl')}" image="/resources/icons/poland_24.png" title="polish"/>
</h:panelGrid>
Run Code Online (Sandbox Code Playgroud)
用css这样:
.top_column1 {
font-weight: normal;
}
.top_column2 {
}
.top_column3 {
width: 78%;
}
.top_column4 {
width: 24px;
}
.top_column5 {
width: 24px;
}
Run Code Online (Sandbox Code Playgroud)
我有这样的效果:
但仍然是通过确定第三列的宽度来实现的,所以如果消息具有不同的长度,则将有两行而不是一行或者所有内容都进入混乱.我应该如何格式化我的面板网格以实现我想要的?
我在我的LanguageOfSystem bean中使用CDI Observer模式.
@Named(value = "languageOfSystem")
@SessionScoped
public class LanguageOfSystem implements Serializable {
@Inject private JsfUtils eeJsfUtils;
@Inject private Event<LangEvent> langEvent;
private LangEvent docLangEvent = new LangEvent();
Run Code Online (Sandbox Code Playgroud)
LangEvent的简单地说:
package jav;
import java.util.Locale;
public class LangEvent {
private Locale locale;
public Locale getLocale() {
return locale;
}
public void setLocale(Locale locale) {
this.locale = locale;
}
}
Run Code Online (Sandbox Code Playgroud)
一切正常,但NetBeans给了我一个警告:

Unstatisfied dependency: no bean matches the injection point.
Run Code Online (Sandbox Code Playgroud)
我应该检查或更改一些东西吗?