Here's an idea:
 Define a CSS class, say 'delete'
.delete {
  background-image: url('path-to-image');
  background-repeat: none;
  background-position: center;
}

Next, 
Make your command link have the class of 'delete', and put a 1x1
transparent gif image, sized to the correct size, inside the commandLink
e.g. <t:commandLink class='delete'><img src='spacer.gif' width='15'
height='15'/></t:commandLink>

Now, depending on which CSS you include, or if the CSS is actually a
JSP, you can include different images for the delete image.  E.g. a
trash can or an X.

Good luck!
Coop
(p.s. I made the JSF stuff up on the fly, so the syntax may be wrong.
The CSS I took from my existing JSP based application)

-----Original Message-----
From: Lisa [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 08, 2007 11:21 PM
To: [email protected]
Subject: Re: <t:commandLink> and image of button - how not to hard code


anyone have any ideas on this one?  How can an image be configured as a
resource in one location and referred to by <t:commandLink throughout
the
application so that it is hardcoded inonly one place.

Is there any way to specify the img file location in a CSS and refer to
it
in the <t:commandLink?

thanks

L



Lisa wrote:
> 
> I have a commandLink below that has a reference to a hard coded path
to
> button image.  Is there a way to simply specify a resource, where that
> resource has the hard coded path to the button?
> 
> If so, where are resources like this typically configured?
> 
> Is there a better way to write the <t:commandLink> below so that the 3
> hard coded paths are gone?
> 
> thanks
> 
> ---
>                                 <t:commandLink
>                                     actionListener="#{myBean.addData}"
>                                     id="btnAdd"
>                                    
> onmouseover="BtnAddImg.src='../../images/AddButtonBlue.gif'; return
true;"
>                                    
> onmouseout="BtnAddImg.src='../../images/AddButtonSilver.gif'; return
> true;"
>                                 >
>
../../images/Pt-Add-Button-Silver.gif 
>                                 </t:commandLink>
> 

-- 
View this message in context:
http://www.nabble.com/%3Ct%3AcommandLink%3E-and-image-of-button---how-no
t-to-hard-code-tf3157766.html#a8881008
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to