Straight HTML with a JSP scriptlet:

<a href="login.do"><img
src="<%=request.getContextPath()%>/images/Compagny.gif" border="0"></a>

With Struts tags:

<html:link page="/security/login.do"><html:img page="/images/Compagny.gif"
border="0" /></html:link>

The border="0" stuff will prevent a blue outline from the link from showing
up around the image, which is normally something you want to supress.

It is possible to access images that are anywhere on the internet. It might
be on the same server in your app's context, same server but not in your
app's context, or it might be at any other web site on the internet. Using
the page attribute of html:img will do the contextPath thing for you, but
you can alternately specify src= or just use a normal HTML img tag and put
whatever URL you want in there if you want to show an image from somewhere
outside your web app.

-Max

----- Original Message -----
From: "Heligon Sandra" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 1:00 AM
Subject: How can one define a hypertext link on an image ?


>
> How can I associate a link (call to an action) to an image with the
> Struts tags ?
>
> I tried
>
> <td width="100%" valign="top" bgcolor="#CCCCCC">
>       <div>
> <html:link href="login.do"> </html:link>
>            <img
> src="<%=request.getContextPath()%>/images/Compagny.gif" border="0"
> align="right"/>
>       </div>
>     </td>
>
> but it dosen't work, the image is displayed but any link is
> available.
> Is it possible to access images that are not located within the
> application directory ?
>
> Thanks a lot in advance
>
> --------------------------------------------------------------------------
--
>
> As of February 12th, 2003 Thomson unifies its email addresses on a
worldwide
> basis.
> Please note my new email address: [EMAIL PROTECTED]
>
> http://www.thomson.net/
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to