• Post Reply Bookmark Topic Watch Topic
  • New Topic

About the html:base problem?  RSS feed

 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone:
I am reading Action in struts book and I have a problem with the "html:base" tag.In a section it say:"JSPs often include references to HTML resources such as images and style
sheets. The most convenient way to refer to these resources is through paths that
are relative to the JSP template. But when the Action forwards control, it does sowithout alerting the browser. If the browser is given any relative references, it will
resolve them according to the Action URI, not the location of the JSP template." It means it is not good to use jsp template?What does he mean and I don't understand.What does the base tag do?Only for find the user's location? :roll:
[ May 04, 2003: Message edited by: Yashnoo lyo ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The base tag is an HTML tag that tells the browser a "base" URL to use when requesting resources that have a relative URL.
Without a base tag, the user's browser will try to use the original request URL as a base. When using servlets or forwarding requests the browser will end up requesting resources such as CSS and images from the wrong URL.
Bill
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But web application such as servlet or forwarding can use the relative URL(For example: /web-inf/images/icon5.gif) to find the resoure.It can do this well before struts. :roll: I don't know whether I says is right.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that if an IMG tag in a HTML page gave a source of "WEB-INF/images/icon5.gif" the browser would not be able to load that image. Web servers are NOT allowed to serve any resource from "WEB-INF" - all part of the security precautions.
Bill
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you William Brogden.I know it.The base is a good method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!