tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Curwen" <gb_...@gb-im.com>
Subject RE: URI Servlet Path Problems
Date Wed, 06 Aug 2003 21:44:51 GMT
I think the way this is 'worked around' in HTML-land is to use the
<base> tag.
 http://www.w3schools.com/tags/tag_base.asp

If you specified this like:

<base href="http://www.yourdomain.com<%= request.getContextPath() %>/"
/>

Then non of your links/form-actions/images would need the web-app name
appended.
 
I'm not sure this is the best use of the base tag though, but I've never
had occasion to use it. Or have I?  ;)


> -----Original Message-----
> From: Gregg Bolinger [mailto:gdboling@embeddedthought.com] 
> Sent: Wednesday, August 06, 2003 4:38 PM
> To: 'Tomcat Users List'
> Subject: RE: URI Servlet Path Problems
> 
> 
> That is pretty much what my understanding was as well.  But I 
> am glad you cleared it up for me.  So appending my webapp 
> folder name is not "bad practice" then.  It is just something 
> that has to be done.
> 
> Thanks Mike.
> 
> Gregg
> 
> -----Original Message-----
> From: Mike Curwen [mailto:gb_dev@gb-im.com] 
> Sent: Wednesday, August 06, 2003 4:35 PM
> To: 'Tomcat Users List'
> Subject: RE: URI Servlet Path Problems
> 
> Sorry, I realized after sending it didn't explain the 
> misunderstanding...
> 
> I got caught up with this not long ago when using 
> sendRedirect, so I think I have this clear in my mind.
> 
> It's all in the browser.
>  
> The browser interprets form actions that begin with slashes 
> as meaning "relative to the domain" so that would result in 
> an action of "/servlet/foo" being requested by the browser as 
> "http://www.yourdomain.com/servlet/foo"
>  
> So unless your application is the deafult application (which 
> in this case it's not, it's /holocron), you'll get a 404.
>  
> If on the other hand you give it no leading slash 
> ("servlet/foo"), the browser says "relative".  But relative 
> to the domain and "folder" (for lack of a much more 
> technically accurate label).  And to a browser, 
> /holocron/secure looks like folders.
> 
> So if you GOT to the form by saying 
> http:///www.yourdomain.com/holocron/secure/showmetheform
> 
> Then all relative urls will be from 
> http://www.yourdomain.com/holocron/secure/
> 


Mime
View raw message