On Wed, 22 Jan 2003, Pani, Gourav wrote:
> Date: Wed, 22 Jan 2003 15:35:00 -0500
> From: "Pani, Gourav" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: pageContext beans
>
> Anybody??? Craig??? Help???
>
Calling pageContext.getServletContext() will get you the ServletContext
instance, although that won't help you get the context path. For that you
need:
HttpServletRequest request =
(HttpServletRequest) pageContext.getRequest();
String contextPath = request.getContextPath();
Craig
> -----Original Message-----
> From: Pani, Gourav [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 22, 2003 1:13 PM
> To: 'Struts Users Mailing List'
> Subject: RE: pageContext beans
>
>
> Ok, here's what my current tag looks like.
>
> <glossary:popup value="Foo.Bar"/>
>
> The HTML it gives is
> <a href="#"
> onClick="window.open('/secure/Catalog.do?value=Foo.Bar', '','toolbar=0,
> width=500,height=500,directories=0,status=0,scrollbars=1,
>
> resizeable=1,menubar=0,location=0,copyhistory=1,fullscreen=0')">
> Foo.Bar
> </a>
>
>
> What I want it to give is a url of /foo/secure/Catalog.do?value=Foo.Bar.
>
>
> In my Tag Java class, I am doing the following.
>
> StringBuffer buf = new StringBuffer("<a href=\"#\" ");
> buf.append(" onClick=\"window.open(");
> buf.append("'/" + + this.url + this.value +"', '',");
> buf.append("'toolbar=" + this.toolbar + ",");
> buf.append("width=" + this.width + ",");
> buf.append("height=" + this.height + ",");
> buf.append("directories=" + this.directories + ",");
> buf.append("status=" + this.status + ",");
> buf.append("scrollbars=" + this.scrollbars + ",");
> buf.append("resizeable=" + this.resizeable + ",");
> buf.append("menubar=" + this.menubar + ",");
> buf.append("location=" + this.location + ",");
> buf.append("copyhistory=" + this.copyhistory + ",");
> buf.append("fullscreen=" + this.fullscreen + "'");
> buf.append(")\">");
> buf.append(this.value);
>
>
> If I could get the servletContext() I could probably append it before
> this.url and it would solve my problem. Of course, if anyone has any other
> suggestions, that would be great too.
>
> -----Original Message-----
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 22, 2003 1:05 PM
> To: 'Struts Users Mailing List'
> Subject: RE: pageContext beans
>
>
>
> I think this will do what you want:
> <html-el:rewrite page="" />
>
> I use it to put the context name in front of links, like this:
> <link rel=stylesheet href="<html-el:rewrite page="" /><tiles:getAsString
> name='stylesheet'/>" type="text/css">
>
> Which produces:
> <link rel=stylesheet href="/bendev/css/style.css" type="text/css">
> in the HTML source on the client.
>
> HTH,
>
> --
> Wendy Smoak
> Applications Systems Analyst, Sr.
> Arizona State University PA Information Resources Management
>
> -----Original Message-----
> From: Pani, Gourav [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 22, 2003 11:00 AM
> To: 'Struts Users Mailing List'
> Subject: RE: pageContext beans
>
>
> Along the same lines, I have a custom tag that I am writing which opens a
> popup window to describe Glossary Items. However, the popup does not get
> the application root in the URL automatically.
>
> For example, if my application root is foo, when I pass in the url
> /secure/Glossary.do, instead of opening up /foo/secure/Glossary.do it tries
> to go to /secure/Glossary.do.
>
> I have been going through JavaDocs related to the BaseTagSupport but to no
> avail. I think getting the servletContext() and appending it in front of
> the URL so that I don't have to add it to the URL path would be the desired
> solution. Does anyone have any ideas as to how I can go about doing that?
> I am ready to face the RTFM inquisition if necessary. :)
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>