You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by KL OOI <oo...@yahoo.com> on 2001/09/14 05:01:32 UTC

errorPage

Hi,

Do anyone here know how to use the following ?

<%@ page errorPage="/jsp/kp/error.jsp?jsp=" + request.getRequestURI() %>

i have put this on top of my JSP page but it seems like not divert me to the
error.jsp.
do i need extra configuration??
any pointer for this??

thanks...

best regards,
kl


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


error Page

Posted by KL OOI <oo...@yahoo.com>.
if i have a simple jsp below....
how do i test it to make sure that the page directive is working?

<%@ page errorPage="/jsp/kp/error.jsp" %>
<html>

<%
 String value = (String)request.getAttribute("value");
%>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Sample JSP</title>
</head>

<body>

<p><font face="Arial">Sample JSP</font></p>
<br>
<%= value %>
<br>
</body>

</html>



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: Security Login Sample by Tomcat

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 14 Sep 2001, KL OOI wrote:

> Date: Fri, 14 Sep 2001 16:41:59 +0800
> From: KL OOI <oo...@yahoo.com>
> Reply-To: tomcat-user@jakarta.apache.org, KL OOI <oo...@yahoo.com>
> To: tomcat-user@jakarta.apache.org
> Subject: Security Login Sample by Tomcat
>
> Hi all,
>
> Do anyone know how to use (create and maintain user/role) the security login
> sample provided by Tomcat??
>

For Tomcat 4, the information on configuring users and roles in Tomcat is
available at:

  http://jakarta.apache.org/tomcat/tomcat-4.0-doc/realm-howto.html

You will also need a basic understanding of container managed security in
web applications.  A good starting point is the Security chapter of the
Servlet Specification <http://java.sun.com/products/servlet/download.html>.

> Thanks.
>
> regards,
> kl
>

Craig


Security Login Sample by Tomcat

Posted by KL OOI <oo...@yahoo.com>.
Hi all,

Do anyone know how to use (create and maintain user/role) the security login
sample provided by Tomcat??

Thanks.

regards,
kl


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: errorPage

Posted by KL OOI <oo...@yahoo.com>.
if i have a simple jsp below....
how do i test it to make sure that the page directive is working?

<%@ page errorPage="/jsp/kp/error.jsp" %>
<html>

<%
 String value = (String)request.getAttribute("value");
%>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Sample JSP</title>
</head>

<body>

<p><font face="Arial">Sample JSP</font></p>
<br>
<%= value %>
<br>
</body>

</html>

----- Original Message -----
From: "Craig R. McClanahan" <cr...@apache.org>
To: <to...@jakarta.apache.org>; "KL OOI" <oo...@yahoo.com>
Sent: Friday, September 14, 2001 11:08 AM
Subject: Re: errorPage


>
>
> On Fri, 14 Sep 2001, KL OOI wrote:
>
> > Date: Fri, 14 Sep 2001 11:01:32 +0800
> > From: KL OOI <oo...@yahoo.com>
> > Reply-To: tomcat-user@jakarta.apache.org, KL OOI <oo...@yahoo.com>
> > To: tomcat-user@jakarta.apache.org
> > Subject: errorPage
> >
> > Hi,
> >
> > Do anyone here know how to use the following ?
> >
> > <%@ page errorPage="/jsp/kp/error.jsp?jsp=" + request.getRequestURI() %>
> >
> > i have put this on top of my JSP page but it seems like not divert me to
the
> > error.jsp.
> > do i need extra configuration??
> > any pointer for this??
> >
>
> The JSP specification, at
<http://java.sun.com/products/jsp/download.html>,
> and the servlet specification at
> <http://java.sun.com/products/servlet/download.html>.
>
> You cannot use a runtime expression here because the page directive is
> evaluated at *compile* time, not at request time.
>
> If you want access to the request URI of the offending page as part of the
> error page, you should dispense with the errorPage attribute of the page
> directive, and use the servlet API capabilities instead.  If you declare
> the following in your /WEB-INF/web.xml file:
>
>   <error-page>
>     <exception-type>java.lang.Throwable</exception-type>
>     <location>/jsp/kp/error.jsp</location>
>   </error-page>
>
> then your error page will be called on *any* exception thrown by any JSP
> page or servlet (you can also have different error pages for different
> exceptions or HTTP status codes, if you want).  Within the page, you can
> access (among others) the following request attribute created by the
> container:
>
>   <%
>     String requestURI = (String)
>      request.getAttribute("javax.servlet.error.request_uri");
>   %>
>
> See the servlet spec chapter on Web Applications for more details.
>
> > thanks...
> >
> > best regards,
> > kl
>
> Craig McClanahan
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: where to find the class's names

Posted by Mikael Aronsson <mi...@telia.com>.
Hi !

The easiest thing would be to do as you where told when you subscribed to
the list, there is no reason to use that kind of language here.

"Please save this message so that you know the address you are
subscribed under, in case you later want to unsubscribe or change your
subscription address."

...

To remove your address from the list, send a message to:
   <to...@jakarta.apache.org>

That's it.
Mikael

----- Original Message -----
From: "Alexandru ANDREI" <al...@fx.ro>
To: <to...@jakarta.apache.org>
Sent: Wednesday, October 03, 2001 10:26 AM
Subject: RE: where to find the class's names


> dear list ...
> HOW THE HELL CAN I UNSUBSCRIBE FROM THIS LIST ???
> Or at least to switch to digest mode ?
>
> -----Original Message-----
> From: Huaxin [mailto:hxzhang@cs.ualberta.ca]
> Sent: Tuesday, October 02, 2001 4:10 PM
> To: tomcat-user@jakarta.apache.org
> Subject: where to find the class's names
>
>
> I see this usage of attribute as below:
>
>   <%
>     String requestURI = (String)
>      request.getAttribute("javax.servlet.error.request_uri");
>   %>
>
> Could anybody tell me where is that javax.servlet.error.request_uri
> defined?
>
>


RE: where to find the class's names

Posted by Alexandru ANDREI <al...@fx.ro>.
dear list ...
HOW THE HELL CAN I UNSUBSCRIBE FROM THIS LIST ???
Or at least to switch to digest mode ?

-----Original Message-----
From: Huaxin [mailto:hxzhang@cs.ualberta.ca]
Sent: Tuesday, October 02, 2001 4:10 PM
To: tomcat-user@jakarta.apache.org
Subject: where to find the class's names


I see this usage of attribute as below:

  <%
    String requestURI = (String)
     request.getAttribute("javax.servlet.error.request_uri");
  %>

Could anybody tell me where is that javax.servlet.error.request_uri
defined?



Re: where to find the class's names

Posted by Will Stranathan <wi...@thestranathans.com>.
Doh - please forgive me - I didn't see I was responding to an already 
correct response.  Didn't mean to imply I was smarter than Craig - I 
just can't read.....

Will

Will Stranathan wrote:

> Will Stranathan
> 
> Craig R. McClanahan wrote:
> 
>>
>> On Tue, 2 Oct 2001, Huaxin wrote:
>>



Re: where to find the class's names

Posted by Will Stranathan <wi...@thestranathans.com>.
javax.servlet.error.request_uri is a key that accesses a value stored in 
the request somewhere (presumably from a servlet that forwards to this 
JSP).  There is no class javax.servlet.error.request_uri.

So there's probably a servlet that actually forwards to this JSP that 
looks something like:

request.setAttribute("javax.servlet.error.request_uri", 
"some_error_page.jsp");
getRequestDispatcher("the_jsp_you_are_reading.jsp").forward(request, 
response);

Will Stranathan

Craig R. McClanahan wrote:

> 
> On Tue, 2 Oct 2001, Huaxin wrote:
> 
> 
>>Date: Tue, 2 Oct 2001 17:09:53 -0600 (Mountain Daylight Time)
>>From: Huaxin <hx...@cs.ualberta.ca>
>>Reply-To: tomcat-user@jakarta.apache.org
>>To: tomcat-user@jakarta.apache.org
>>Subject: where to find the class's names
>>
>>I see this usage of attribute as below:
>>
>>  <%
>>    String requestURI = (String)
>>     request.getAttribute("javax.servlet.error.request_uri");
>>  %>
>>
>>Could anybody tell me where is that javax.servlet.error.request_uri
>>defined?
>>
>>
> 
> Note that this is not the name of a *class* - it is the name of a *request
> attribute*.
> 
> It's defined in the Servlet Specification, which you can download from:
> 
>   http://java.sun.com/products/servlet/download.html
> 
> In the 2.3 spec, see Section 9.9.
> 
> Basically, if you declare an <error-page> to handle a particular type of
> exception or HTTP status code thrown by your servlet, the container will
> set a number of request attributes for you before calling your error page.
> In particular, the attribute you describe above tells you what request URI
> caused the error to occur - other attributes include things like the
> exception that was thrown.
> 
> Craig McClanahan
> 
> 
> 



Re: where to find the class's names

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 2 Oct 2001, Huaxin wrote:

> Date: Tue, 2 Oct 2001 17:09:53 -0600 (Mountain Daylight Time)
> From: Huaxin <hx...@cs.ualberta.ca>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: where to find the class's names
>
> I see this usage of attribute as below:
>
>   <%
>     String requestURI = (String)
>      request.getAttribute("javax.servlet.error.request_uri");
>   %>
>
> Could anybody tell me where is that javax.servlet.error.request_uri
> defined?
>

Note that this is not the name of a *class* - it is the name of a *request
attribute*.

It's defined in the Servlet Specification, which you can download from:

  http://java.sun.com/products/servlet/download.html

In the 2.3 spec, see Section 9.9.

Basically, if you declare an <error-page> to handle a particular type of
exception or HTTP status code thrown by your servlet, the container will
set a number of request attributes for you before calling your error page.
In particular, the attribute you describe above tells you what request URI
caused the error to occur - other attributes include things like the
exception that was thrown.

Craig McClanahan



where to find the class's names

Posted by Huaxin <hx...@cs.ualberta.ca>.
I see this usage of attribute as below:

  <%
    String requestURI = (String)
     request.getAttribute("javax.servlet.error.request_uri");
  %>

Could anybody tell me where is that javax.servlet.error.request_uri
defined?




Re: errorPage

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 14 Sep 2001, KL OOI wrote:

> Date: Fri, 14 Sep 2001 11:01:32 +0800
> From: KL OOI <oo...@yahoo.com>
> Reply-To: tomcat-user@jakarta.apache.org, KL OOI <oo...@yahoo.com>
> To: tomcat-user@jakarta.apache.org
> Subject: errorPage
>
> Hi,
>
> Do anyone here know how to use the following ?
>
> <%@ page errorPage="/jsp/kp/error.jsp?jsp=" + request.getRequestURI() %>
>
> i have put this on top of my JSP page but it seems like not divert me to the
> error.jsp.
> do i need extra configuration??
> any pointer for this??
>

The JSP specification, at <http://java.sun.com/products/jsp/download.html>,
and the servlet specification at
<http://java.sun.com/products/servlet/download.html>.

You cannot use a runtime expression here because the page directive is
evaluated at *compile* time, not at request time.

If you want access to the request URI of the offending page as part of the
error page, you should dispense with the errorPage attribute of the page
directive, and use the servlet API capabilities instead.  If you declare
the following in your /WEB-INF/web.xml file:

  <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/jsp/kp/error.jsp</location>
  </error-page>

then your error page will be called on *any* exception thrown by any JSP
page or servlet (you can also have different error pages for different
exceptions or HTTP status codes, if you want).  Within the page, you can
access (among others) the following request attribute created by the
container:

  <%
    String requestURI = (String)
     request.getAttribute("javax.servlet.error.request_uri");
  %>

See the servlet spec chapter on Web Applications for more details.

> thanks...
>
> best regards,
> kl

Craig McClanahan