You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Luis Arias <lu...@elysia.com> on 2000/08/28 15:38:25 UTC
PATCH :
Hello,
I found the need to include a <base> tag in the <head> of my JSP pages in
order to correctly handle relative URLs for images and such without having
to worry about context path issues.
The <struts:base> tag generates a correct <base> tag.
Here's the patch:
cvs diff struts.tld (in directory C:\DEV\jakarta-struts\src\conf\)
Index: struts.tld
===================================================================
RCS file: /home/cvspublic/jakarta-struts/src/conf/struts.tld,v
retrieving revision 1.27
diff -r1.27 struts.tld
1790a1791,1794
> <tag>
> <name>base</name>
> <tagclass>org.apache.struts.taglib.BaseTag</tagclass>
> </tag>
There is also the new BaseTag.java which is included as an attachment.
I am reading through Craig's TODO list and would like to contribute as a
committer in the future.
--
Luis Arias
Elysia - http://www.elysia.com
1, rue de Stockholm
75008 PARIS
FRANCE
+33 1 44 70 70 90
+33 1 44 70 72 09 fax
+33 6 14 20 87 93 mobile
struts-dev-unsubscribe@jakarta.apache.org
Posted by Raphaele Giordan <ra...@noos.fr>.
Re: PATCH :
Posted by Luis Arias <lu...@elysia.com>.
Hi Craig,
> I like the idea of auto-generating a base tag, but I've got a question.
Your
> current BaseTag class generates a <base> value that is the complete URL of
the
> current page. Isn't that already the default if you don't have a <base>
tag
> at all?
The problem is that when you use a request dispatcher to forward to a JSP
page from the controler servlet, the browser isn't aware of the url of the
JSP page, only the servlet's URL. I haven't tried to generate a partial
URL, say without the protocol, because it seemed to me after reading the
<base> tag documentation that the href attributed only accepted a complete
URL, but I may be wrong on this.
>
> Thinking about auto-generating a <base> tag did trigger one thought in my
> head: would it make sense to be able to generate a <base> tag that is for
the
> context root itself? That way, you could refer to images and other
resources
> with URIs that are relative to the same place that RequestDispatcher
arguments
> are relative to.
>
> What do you think?
>
> Craig
>
>
Well that is the purpose of the code I submitted ! There must be some
misunderstanding here... Anyway, the idea is to use relative URIs for those
resources so that there is no reference to the context path in the JSP
code...
Luis.
Re: PATCH :
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Luis Arias wrote:
> Hello,
>
> I found the need to include a <base> tag in the <head> of my JSP pages in
> order to correctly handle relative URLs for images and such without having
> to worry about context path issues.
>
> The <struts:base> tag generates a correct <base> tag.
>
I like the idea of auto-generating a base tag, but I've got a question. Your
current BaseTag class generates a <base> value that is the complete URL of the
current page. Isn't that already the default if you don't have a <base> tag
at all?
Thinking about auto-generating a <base> tag did trigger one thought in my
head: would it make sense to be able to generate a <base> tag that is for the
context root itself? That way, you could refer to images and other resources
with URIs that are relative to the same place that RequestDispatcher arguments
are relative to.
What do you think?
Craig