Have you looked at the HttpServletRequest api? There a bunch of methods that parse out and return different parts of the request URL (like getServletPath()...). I'm not sure (I've never tried, and unfortunately I'm not in a position to give it a test right now) but I think what you are looking for is probably there (?). Otherwise, I would suggest looking through the struts source (probably starting in the ActionServlet) to see if you can determine how the framework deals with it.
Good Luck! Troy On Tue, 2002-09-03 at 17:42, Andreas wrote: > Thanks for the reply Troy. > > That takes care of the "appname" but does not give me the > "servletmappingurlpattern". > > The "servletmappingurlpattern" information is configured in the web.xml > file and is specified within the <servlet-mapping> tag that follows the > <servlet> tag which defines the struts control servlet. In my case the > <servlet-mapping> tag appears as follows > > <servlet-mapping> > <servlet-name>action</servlet-name> > <url-pattern>/servletmappingurlpattern/*</url-pattern> > </servlet-mapping> > > If I recall correctly this is only one of two options for how to > determine which url-patterns can be mapped to the struts action servlet. > The other would be > > <servlet-mapping> > <servlet-name>action</servlet-name> > <url-pattern>/*.do</url-pattern> > </servlet-mapping> > > I am not dealing with the latter case only the former. Does anyone know > how the information in the <servlet-mapping> tag can be retrieved from > within an Action class using standard api's. I am starting to believe > that this would not be a struts api, but rather a servlet configuration > api of some sort. > > Any help appreciated. > Andreas > > > > -----Original Message----- > > From: Troy Hart [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, September 03, 2002 15:53 > > To: Struts Users Mailing List > > Subject: Re: Question about App Name and url-pattern servlet-mapping > > > > > > You can look at <html:rewrite/>, but you will probably have the same > > nested tag problem (?). Alternatively, you can use the following > > scriptlet: > > > > <% String url = request.getContextPath() + relativeURL %> > > > > Then pass your url String around as needed. NOTE: you may need to do > > something additional to capture the 'module name' if you are using the > > module (sub-app) features of struts-1.1. > > > > Hope this helps, > > > > Troy > > > > > > > > On Tue, 2002-09-03 at 15:55, Andreas wrote: > > > I need to pass a url as a parameter to a JSP page. I can't > > rely on just > > > using the relative path. > > > > > > Currently the urls that map to struts actions look like this > > > > > > > > http://localhost/appname/servletmappingurlpattern/path/that/re > solves/to/ > > struts/action > > > > When using the struts tag html:link all that I have to specify is > > /path/that/resolves/to/struts/action. > > > > I need to programatically retrieve or construct > > /appname/servletmappingurlpattern part of the url. One way to do this > > is to just parse the url, but I would rather use the proper api if > there > > is one. > > > > I can't use the html:link tag as the page attribute won't accept > nested > > tags. > > > > Does anyone know how to do this? > > > > Thanks in advance, > > Andreas > > > > > > PS If there is a place to search old postings, please point it out to > > me. > > > > -- > 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]>

