Hmmm....apparently I have made someone (no names) feel insecure about their
abilities and/or knowledge of struts (hence the vicious personal attack)
My intentions were not to piss anyone off.
I just don't think they understand what's "really" happening.
**DISCLAIMER**
If you don't read this entire message then you have no right to reply to it.
Also, the example uses a .jpg file. This could just have easily been a
.swf, .jar (applet), .class (applet), .gif or whatever.
*Note there are 3 types of URLs
#1 - relative to the file/dir
examples ("somefile.txt", "somedir/somefile.txt", "./somedir/somefile.txt",
"../subdir/otherfile.txt")
#2 - relative to the application ("/somefile.txt")
examples ("/somefile.txt", "/somedir/somefile.txt")
#3 - absolute
examples ("http://jakarta.apache.com/struts/somefile.txt")
I'll use the struts-example for my explanation.
* Prep
I moved the registration.jsp under the WEB-INF and
changed the reference to it (2 places) in the struts-config.xml
Then I copied the <html:img page="/struts-power.gif"
alt="Powered by Struts"/> from index.jsp and placed
it at the bottom of registration.jsp (just above the ending body tag)
I created the link in every possible way that I know how.
There may be additional ways, but this makes my point clear.
I'll refer to these by their associated index
Here's the source
1.1 <html:img src="struts-power.gif" alt="Powered by Struts"/><br>
1.2 <html:img src="/struts-power.gif" alt="Powered by Struts"/><br>
1.3 <html:img src="/struts-example/struts-power.gif" alt="Powered by
Struts"/><br>
1.4 <html:img src="struts-example/struts-power.gif" alt="Powered by
Struts"/><br>
1.5 <html:img src="WEB-INF/struts-power.gif" alt="Powered by Struts"/><br>
1.6 <html:img src="/WEB-INF/struts-power.gif" alt="Powered by
Struts"/><br>
1.7 <html:img src="/struts-example/WEB-INF/struts-power.gif" alt="Powered
by Struts"/><br>
1.8 <html:img src="struts-example/WEB-INF/struts-power.gif" alt="Powered
by Struts"/><br>
1.9 <html:img src="http://localhost/struts-example/struts-power.gif"
alt="Powered by Struts"/><br>
1.10 <html:img
src="http://localhost/struts-example/WEB-INF/struts-power.gif" alt="Powered
by Struts"/><br>
1.11 <html:img page="struts-power.gif" alt="Powered by Struts"/><br>
1.12 <html:img page="/struts-power.gif" alt="Powered by Struts"/><br>
1.13 <html:img page="/struts-example/struts-power.gif" alt="Powered by
Struts"/><br>
1.14 <html:img page="struts-example/struts-power.gif" alt="Powered by
Struts"/><br>
1.15 <html:img page="WEB-INF/struts-power.gif" alt="Powered by
Struts"/><br>
1.16 <html:img page="/WEB-INF/struts-power.gif" alt="Powered by
Struts"/><br>
1.17 <html:img page="/struts-example/WEB-INF/struts-power.gif" alt="Powered
by Struts"/><br>
1.18 <html:img page="struts-example/WEB-INF/struts-power.gif" alt="Powered
by Struts"/><br>
1.19 <html:img page="http://localhost/struts-example/struts-power.gif"
alt="Powered by Struts"/><br>
1.20 <html:img
page="http://localhost/struts-example/WEB-INF/struts-power.gif" alt="Powered
by Struts"/><br>
Here is the rendered html from the page:
The ones with the x in front are the ones that actually displayed in the
browser.
[using "(" instead of "<"]
1.1 (img src="struts-power.gif" alt="Powered by Struts">(br>
1.2 (img src="/struts-power.gif" alt="Powered by Struts">(br>
1.3 x(img src="/struts-example/struts-power.gif" alt="Powered by
Struts">(br>
1.4 (img src="struts-example/struts-power.gif" alt="Powered by
Struts">(br>
1.5 (img src="WEB-INF/struts-power.gif" alt="Powered by Struts">(br>
1.6 (img src="/WEB-INF/struts-power.gif" alt="Powered by Struts">(br>
1.7 (img src="/struts-example/WEB-INF/struts-power.gif" alt="Powered by
Struts">(br>
1.8 (img src="struts-example/WEB-INF/struts-power.gif" alt="Powered by
Struts">(br>
1.9 x(img src="http://localhost/struts-example/struts-power.gif"
alt="Powered by Struts">(br>
1.10 (img src="http://localhost/struts-example/WEB-INF/struts-power.gif"
alt="Powered by Struts">(br>
1.11 (img src="/struts-examplestruts-power.gif" alt="Powered by
Struts">(br>
1.12 x(img src="/struts-example/struts-power.gif" alt="Powered by
Struts">(br>
1.13 (img src="/struts-example/struts-example/struts-power.gif"
alt="Powered by Struts">(br>
1.14 (img src="/struts-examplestruts-example/struts-power.gif" alt="Powered
by Struts">(br>
1.15 (img src="/struts-exampleWEB-INF/struts-power.gif" alt="Powered by
Struts">(br>
1.16 (img src="/struts-example/WEB-INF/struts-power.gif" alt="Powered by
Struts">(br>
1.17 (img src="/struts-example/struts-example/WEB-INF/struts-power.gif"
alt="Powered by Struts">(br>
1.18 (img src="/struts-examplestruts-example/WEB-INF/struts-power.gif"
alt="Powered by Struts">(br>
1.19 (img
src="/struts-examplehttp://localhost/struts-example/struts-power.gif"
alt="Powered by Struts">(br>
1.20 (img
src="/struts-examplehttp://localhost/struts-example/WEB-INF/struts-power.gif
" alt="Powered by Struts">(br>
* When you go to http://localhost/struts-example/
You get the index.jsp served to you. ( I know that you already know
that )
So that means that you will see http://localhost/struts-example/index.jsp
in your browser window.
This is true for IE and Netscape
* When you click on the link to register, the /editRegistration.do,
struts processes the request and serves up the /WEB-INF/registration.jsp
BUT WAIT!! It *DOESN'T* say
http://localhost/struts-example/WEB-INF/registration.jsp in the browser!
It says
http://localhost/struts-example/editRegistration.do;jsessionid=B2BEA26D0CE8E
F4F0F6E16B095F74F4A?action=Create
(sessionid may different because "the names have been changed to protect
the innocent")
If the registration.jsp is under the WEB-INF directory, then why do some
of my images correctly show up?
Because there is a another little tag in there like this: <html:base/>
This tag writes (base
href="http://localhost/struts-example/WEB-INF/registration.jsp")
(I'm using "(" for "<" so it will show up in the emails of those with
HTML view enabled)
All links of type #1 would start in directory
http://localhost/struts-example/WEB-INF
All links of type #2 would start in directory
http://localhost/struts-example
All links of type #3 would "get" from whatever it says (e.g. the browser
doesn't have to translate or relate anything) this is the same hangup some
people have with sending HTML e-mail)
If you are letting the servlet container handle all file types then the
image won't be served if using type #1 or type #3 (if getting from WEB-INF).
If you are using apache in combo with tomcat then this may change because
you could let apache handle content other than .do or jsp or whatever (See
http://www.moreservlets.com/Using-Tomcat-4.html to find out more)
*Special Exception - If our application was named as the root context
then the following would have displayed as well:
1.1
1.2
I hope this helps
JM
PS. I can't believe I had to write a book to explain this. However, I fear
that someone (no names) still doesn't understand my point and may resort to
sending a mean and hateful e-mail with my name blasted on the subject line
and ..........doh!!! Too late ;)
You're right Mark, that stove is pretty hot.
> -----Original Message-----
> From: Joseph Barefoot [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 1:47 PM
> To: Struts Users Mailing List
> Subject: RE: James Mitchell is a kind and generous person
>
>
> I'll drink to that. 'Course, I'm aiming for a state of Zen-like bliss in
> which I code by sheer intuition. :)
>
> > -----Original Message-----
> > From: Eddie Bush [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 01, 2002 10:37 AM
> > To: Struts Users Mailing List
> > Subject: Re: James Mitchell is a kind and generous person
> >
> >
> > Friday - not a day of the week, but a state of mind =)
> >
> > ----- Original Message -----
> > From: "James Mitchell" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Wednesday, May 01, 2002 12:20 PM
> > Subject: James Mitchell is a kind and generous person
> >
> >
> > > I'll be done with my rebuttal shortly.
> > >
> > > JM
> > >
> > > --
> > > 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]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>