Hi again,
please see comments below:
> -----Ursprüngliche Nachricht-----
> Von: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> Gesendet am: Samstag, 2. Dezember 2000 02:27
> An: [EMAIL PROTECTED]
> Betreff: Re: AW: [PATCH REPOST] Tomcat 4.0 JSP Examples view Source
>
> Pierre Delisle wrote:
> > [...]
> > > All other examples execute the JSP if I hit Source. I can also let the
> > > example execute
> > > when I hit 'Execute'.
> >
> > The 'Execute' link points to the jsp file itself (so the page
> is executed
> > when the link is selected), while the 'source' link points to
> an html file,
> > which itself displays a link that points to a .txt file
> containing the source code.
> > (so the source code is displayed when the link is selected).
>
> I bet this problem only occurs with IE. It tries to be smarter
> than the server,
Ah! Yes, im using IE 5.5. I currently have no Netscape here to try.
> and totally ignores the Content-Type header. Instead it looks for HTML
> elements in the response body, and if it finds one it tries to render
> the response as HTML. Since the .txt file contains both HTML and JSP
> elements, the result is that IE shows a rendering of the HTML and hides
> all JSP elements :-(
That would make sense and explain the misunderstandings Piere and I seemed
to have.
Funny enough the behavior under IE seems to be exactly the oposit of what
Piere explained:
"/examples/jsp/source.jsp?/jsp/num/numguess.jsp"
displayes the source code as HTML listing and
"numguess.txt"
executes the JSP example.
At least we have now consistent behavior after Pieres patch to numberguess.
Should we mention this behaviour in the README.txt?
I bet many people use IE and wonder about this behaviour (like myself :)
>
> I have attached a hack I use to show the source for all example pages
> in my upcoming JSP book. Use it if you like. It takes the JSP source file
> and converts all HTML special characters into HTLM character
> entities. IE can
> then happily render it as HTML.
>
> To use it, just map it to a name (e.g. jspSource) and use a URI like
> /jspSource/<context-relative-path-to-JSP-page>.
I will give it a try.
> Note! Even though it does test the path for ".." and "WEB-INF", I can't
> guarantee that it handles all possible security threats. In other words,
> this servlet should *not* be installed on a production site.
>
> Hans
> --
> Hans Bergsten [EMAIL PROTECTED]
> Gefion Software http://www.gefionsoftware.com
Thanks for clarification,
Best Regards,
Hans
Hans Schmid