Campano, Troy wrote:
> What I did was I needed my errorPage to catch my SQL, so someone
 > recommended storing the SQL in a session just before I executed it
 > so that SQL Session could be read on the errorPage. That worked
 > for me.

Sure, it works in most cases. But the session scope is "wider" than
what you need for this, and it may give unexpected results if you
happen to get two requests that fail for different reasons from the
same user (part of the same session, so they overwrite each others
error data). The request scope is much more appropriate for this
kind of thing.

Hans

> -----Original Message-----
> From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 29, 2002 12:20 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Dynamic parameter to error page
>
>
> Alireza Nahavandi wrote:
>
>>Hi All,
>>
>>I need to pass a dynamic parameter to an error page :
>>
>><%@ page errorPage="error.jsp?fn=b.jsp&id=xxxx" %>
>>
>>Is there any way to make xxxx dynamic ?
>
>
> No, the page directive is not evaulated at runtime (only translation time). To pass 
>dynamic data to an error page, store it in the request scope instead. With JSTL, you 
>can use something like this:
>
>    <c:set var="id" scope="request"
>      value="${someExpressionWithTheIdValue}" />
>
> The "id" variable is then available to EL expressions in the error page.
>
> If you're using a JSP 1.1 container (and therefore can not use JSTL), you can use 
><jsp:useBean>, a custom action or a scriptlet to store the "id" in the request scope 
>instead:
>
>    <% request.setAttribute("id", aScriptingVariableWithTheId); %>
>
> Hans
> --
> Hans Bergsten           [EMAIL PROTECTED]
> Gefion Software         http://www.gefionsoftware.com
> JavaServer Pages        http://TheJSPBook.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For 
>digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some 
>relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>


--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to