That works too. I ended up going with:

     HttpServletRequest req = (HttpServletRequest)
this.pageContext.getRequest();
     StringBuffer resource = new StringBuffer(req.getServletPath());

Would one be preferred over the other?

Just FYI, we're 2.5 weeks from code cutoff with our 1st release that is
"Powered by Struts".  But we have an early 1st code cutoff... we're still
2-3 months from GA. We're up to 46 action classes at this point... it should
double/triple by the end of the release. I can't imagine how many we'll have
at the end of next release. 

All is well and Struts evangelists are starting to crawl out from
everywhere.

Thanks to all the Struts developers for a great product.

Wayne
[EMAIL PROTECTED]



-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 10:00 PM
To: Struts-Dev@Jakarta. Apache. Org (E-mail)
Subject: Re: extract .jsp name in extended HtmlTag




On Wed, 11 Jul 2001, Young, Wayne wrote:

> I need to modify HtmlTag to output the .jsp name of the page that
contained
> the <html:html> tag in a hidden field or comment. This is for debugging
and
> also to link into our help system.
> 
> Any ideas on how to do this from within doStartTag()?
> 

You could do something like:

        HttpServletRequest request = (HttpServletRequest)
          pageContext.getRequest();
        String requestURI = request.getRequestURI();

        sb.append("<!-- PAGE: ");
        sb.append(requestURI);
        sb.append("-->");

just before the ResponseUtils.write() call.

Alternatively, you might consider just using the <html:base> tag in your
<head> section.  This will render a <base> element that includes the
absolute path of the current page -- and, as an extra added bonus it will
make relative references to images and stylesheets work correctly, even
when you forward to this page from a Action.

> Thanks.
> 
> Wayne
> [EMAIL PROTECTED]
> 

Craig

Reply via email to