I want to set an icon from the CMS on a p:commandButton. How can I achieve this?

asked 06.03.2014 at 14:46

Peter%20St%C3%B6ckli's gravatar image

Peter Stöckli ♦
accept rate: 69%

You can do this by defining a CSS style:

    background-image: url("#{resource['ivy-cms:images/myIcon']}") !important;

and then use it like this on the commandButton:

<p:commandButton actionListener="#{logic.closed}" update="form" value="hallo" image="ui-icon-my" />

Which will then look like this: alt text


answered 06.03.2014 at 14:50

Peter%20St%C3%B6ckli's gravatar image

Peter Stöckli ♦
accept rate: 69%

Thank you for the answer Peter! Additionally there is a possibility to get Icons dynamically:

<c:forEach items="#{data.navElems}" var="n"> 
  <p:menuitem value="#{n.description}" icon="#{resource[n.imageUrl]}" /> 

The n.imageUrl is like: 'ivy-cms:/nav1/_image'


answered 06.03.2014 at 18:01

Alexis's gravatar image

accept rate: 66%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 06.03.2014 at 14:46

Seen: 4,714 times

Last updated: 06.03.2014 at 18:01