File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Description of the base tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Description of the base tag" Watch "Description of the base tag" New topic

Description of the base tag

Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
Ok, so what is the description of the base tag, because apparently I've had it wrong.

I was under the impression that base would set the base path to to location where the jsp being viewed is located. However, in the case about this isn't the case, so apparently I've been wrong. The js folder is a sub folder of the folder the JSPs are in. That JSP folder is called form, which is a sub of the application

ie.. localhost:8080/app/form/js is the dir structure.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here is a link to the documentation.

Here's what it says:
Renders an HTML <base> element with an href attribute pointing to the absolute location of the enclosing JSP page. This tag is valid only when nested inside an HTML <head> element.

One thing you need to be aware of, though, is that this will not work if you put your JSP files in the WEB-INF/ folder as many developers do.

Consultant, Sima Solutions
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Are you saying that your example is not working? It seems like it should. Are you using tiles? What do you see in the html generated?

I will add this as well...this tag caused my project (and other projects) some grief when we deployed to production where we are using an HTTPS accelerator. From what I recall, using this tag caused links to include "http://" where they should have had "https://"

- Brent
I agree. Here's the link:
subject: Description of the base tag
It's not a secret anymore!