Reputation:
I'm add user defined image commandbutton button its not working.I try to below code:
<p:commandButton id="addMoreButton" value=""
action="#{ContactDetails.addMoreButtonAction}" image="#{General.image}"/>
In replace of image to use icon attribute icon="addMoreImageButton" but it also not working. css:
.addMoreImageButton
{
background-image: url("#{GeneralPageAttributes.addMoreImageButton}");
}
I need only image in button not text then what attribute to choosen it.
Upvotes: 0
Views: 1430
Reputation: 4730
There are following ways, you can create a image button: (Tested Code)
[Using commandButton]
<p:commandButton id="addMoreButton" value="" action="#"
image="http://c.dryicons.com/images/icon_sets/christmas_surprise_four_in_one/png/128x128/frost_button.png" />
If the 'image'
attribute for commandButton is specified, button will be of type image without any text on it, even if the 'value'
attribute is specified with some String.
[Using commandLink]
<p:commandLink id="addMoreButton1" value="" action="#">
<p:graphicImage url="http://c.dryicons.com/images/icon_sets/christmas_surprise_four_in_one/png/128x128/frost_button.png" />
</p:commandLink>
Use your bean action in place of #. Also specify styleClass or style attribute to further beautify your controls.
Upvotes: 2