-
1. Re: How to add background image and icon to a JSF button?
sunkaram Feb 16, 2012 12:17 PM (in response to ashishagw)did you try 'image' property of
<h:commandButton ?
-
2. Re: How to add background image and icon to a JSF button?
ashishagw Feb 16, 2012 12:29 PM (in response to sunkaram)Hey Sunkara,
I treid but the image is coming as background image, but I want to to have a image as background and other image as icon.
-
3. Re: How to add background image and icon to a JSF button?
vi_mahe_ka1 Feb 21, 2012 2:17 AM (in response to ashishagw)try this
<button type="button">
<a4j:support event="onclick" action="..." reRender="..."></a4j:support>
<h:graphicImage value="/pages/tennessee.gif"></h:graphicImage><h:outputText value="test"></h:outputText>
<h:graphicImage value="/pages/texas.gif"></h:graphicImage>
</button><a4j:commandButton type="image"
image="/images/icons/copy.gif" align="left">Save</a4j:commandButton> -
4. Re: How to add background image and icon to a JSF button?
liuliu Feb 21, 2012 3:21 AM (in response to ashishagw)hi,
i think you cant get what you want just with css. primefaces has a component imagebutton, it works fine with RF.
liu
-
5. Re: How to add background image and icon to a JSF button?
josh68 Sep 10, 2012 4:11 PM (in response to vi_mahe_ka1)Just a note that in my project, <a4j:commandButton type="image" image="path to image" /> works, but only if you do not use a JSF2-type resource identifier for the image attribute (eg, image="#{resource['images:my_custom_image.gif']}"). For some reason, when I try that, the resulting path contains a doubled root (eg, "/myApp/myApp/faces/javax.faces.resource/my_custom_image.gif?ln=images"). I use JSF2-type resource identifiers all over my application, and this is the only place it fails to work correctly. So, instead, I have to use a relative path (eg, image="../../resources/images/my_custom_image.gif").
Seems like this may be a bug in RF 4.x. I'm using 4.2.
Thanks.
-
6. Re: How to add background image and icon to a JSF button?
healeyb Sep 13, 2012 8:07 AM (in response to josh68)It's just so much easier to use:
<..:commandLink>
<h:graphicImage .../>
</...:commandLink>
I can't think of any real difference in what it does.
Regards,
Brendan.
Freelance Java Enterprise Developer
JSF Richfaces Ajax Java 6/7 (scjp) EE 6 HTML CSS JavaScript jQuery MySQL JPA Hibernate Eclipselink
Spring Oracle SQL JPQL Sybase EJB CDI Glassfish Apache JAX-RS Primefaces UNIX Paypal and more..