You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Van Stalle <ja...@cec.eu.int> on 2006/09/25 13:28:15 UTC

custom tag and html:rewrite

Hey,

I am writing a custom tag and I need to rewrite a link to an image from with
the tag-code (by overiding the doStartTag method);

 I know that in a jsp-page you can do this with html:rewrite .. but how to
do this from within java-code ?

Any hints would be welcome.

Jan
-- 
View this message in context: http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6484600
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: custom tag and html:rewrite

Posted by Van Stalle <ja...@cec.eu.int>.
Martin,

I found the solution myself; here is the code: this gives me an url which is
valid in the context of my application.

Thanks for your response,

Jan

import org.apache.struts.taglib.TagUtils;
...

        TagUtils utils = TagUtils.getInstance();
        String img = null;
        try {
            img = utils.computeURL(pageContext, null, null,
"/images/timeIcon.gif", null, null, null, null, false);
            System.out.println("img = " + img);
        } catch (MalformedURLException e) {
            e.printStackTrace();  
        }




Martin Gainty wrote:
> 
> Hello Jan-
> 
> I found this page to be quite helpful when manipulating image attributes
> http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/index.html#image
> Here is the javadoc for the doStartTag
> http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/javadoc/index.html
> 
> M-
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please
> notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
> 
> 
> 
> ----- Original Message ----- 
> From: "Van Stalle" <ja...@cec.eu.int>
> To: <us...@struts.apache.org>
> Sent: Monday, September 25, 2006 7:28 AM
> Subject: custom tag and html:rewrite
> 
> 
>> 
>> Hey,
>> 
>> I am writing a custom tag and I need to rewrite a link to an image from
>> with
>> the tag-code (by overiding the doStartTag method);
>> 
>> I know that in a jsp-page you can do this with html:rewrite .. but how to
>> do this from within java-code ?
>> 
>> Any hints would be welcome.
>> 
>> Jan
>> -- 
>> View this message in context:
>> http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6484600
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>>
> 

-- 
View this message in context: http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6487985
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: custom tag and html:rewrite

Posted by Martin Gainty <mg...@hotmail.com>.
Hello Jan-

I found this page to be quite helpful when manipulating image attributes
http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/index.html#image
Here is the javadoc for the doStartTag
http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/javadoc/index.html

M-
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Van Stalle" <ja...@cec.eu.int>
To: <us...@struts.apache.org>
Sent: Monday, September 25, 2006 7:28 AM
Subject: custom tag and html:rewrite


> 
> Hey,
> 
> I am writing a custom tag and I need to rewrite a link to an image from with
> the tag-code (by overiding the doStartTag method);
> 
> I know that in a jsp-page you can do this with html:rewrite .. but how to
> do this from within java-code ?
> 
> Any hints would be welcome.
> 
> Jan
> -- 
> View this message in context: http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6484600
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>