Is there no way to tell if a .jsp has been invoked via a request dispatcher?
ie. no attributes in the request are set which all .jsp pages could check?
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Hans Bergsten
> Sent: Thursday, July 13, 2000 2:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Extending JSP pages
>
>
> "Williams, Stephen" wrote:
> >
> > Jim Preston wrote:
> > > Jason's example shows adding an alias for "*.html" that maps
> > > to the file handler and then a Deblink servlet (an example
> > > servlet that just looks for "<blink>" tags and removes them).
> > > It doesn't look to me like there is any reason that you can't
> > > add a "/foo/*.jsp" and a "/bar/*.jsp" where one maps to the
> > > standard JSP handler and the other maps to that plus a
> > > servlet of your choice.
> >
> > The trick I'm not sure of is how to get an alias to map to my
> servlet *plus*
> > the standard JSP handler. I know that some servlet engines
> allow servlets
> > to be chained together, which might do the trick. Or, my
> servlet could call
> > the servlet engine's standard JSP handler (as long as that is a
> servlet).
> > Anyone think that would work?
>
> You have to do something like this (assuming a Servlet 2.2 web application
> structure). You store your JSP pages in a structure like this:
>
> myapp/foo.jsp
> myapp/bar.jsp
> myapp/other/fee.jsp
> myapp/other/baz.jsp
>
> If you want requests for the JSP pages in the /other directory to
> be processed
> first by a servlet and then by the standard JSP container, you
> can do this.
> First define a URI mapping for the servlet in WEB-INF/web.xml:
>
> <web-app>
> <servlet>
> <servlet-name>controller</servlet-name>
> <servlet-class>ControllerServlet</servlet-class>
> </servlet>
> ...
> <servlet-mapping>
> <servlet-name>controller</servlet-name>
> <url-pattern>/controller/*</url-pattern>
> </servlet-mapping>
> ...
> </web-app>
>
> Then you request the JSP pages with URIs like:
>
> /myapp/controller/other/fee.jsp
>
> This URI maps to the controller servlet, so it will be invoked. It can get
> the context-relative URI for the JSP page like this:
>
> String uri = request.getPathInfo();
>
> When it's ready to let the JSP container process the JSP page, it gets
> a RequestDispatcher and includes or forwards to the JSP page:
>
> RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
> rd.include(request, response);
>
> Note that nothing prevents a user from requesting the JSP page directly,
> with a URI like /other/fee.jsp. Depending on which container you use,
> you may be able to use security constraints to restrict access to URIs
> like this though.
>
> Hans
> --
> Hans Bergsten [EMAIL PROTECTED]
> Gefion Software http://www.gefionsoftware.com
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets