Forums Register Login

How to determine page type

+Pie Number of slices to send: Send
Hello everyone,

I have question, in flow of my application i need to determine if the current pagetype is errorPage or not.How to get the value of isErrorPage attribute used withing page directive ? Is there any way to get this, other than that also i wonder if it is possible to get value of directive attributes ?

Thanks in advance
[ July 02, 2007: Message edited by: Kudret Serin ]
+Pie Number of slices to send: Send
any help ??
+Pie Number of slices to send: Send
Hello,

in page directive (<%@ page ) it has two attributes 1)errorPage 2)isErrorPage. when any exception occurs in your pplication to show the user friendly message to the user you can define a jsp(errorpage) by specifying the 'isErrorPage='true'' in the page directive like <%@ page isErrorPage="true" %> and in all other JSP pages you need to set this error page URL to the errorPage attribute of the 'page' directive like '<%@ page errorPage="jsp/errorPage.jsp" %>' . what it does is if any exception occurs in any of your JSPs it redirects that exception to the JSP which is mentioned in 'errorPage' URL.

i hope it helps.
+Pie Number of slices to send: Send
I would like to add a few more points:

by defaulat 'isErrorPage' is set to 'false' , if you set 'isErrorPage="true"
in any JSP , the implicit object 'Exception' will be available to that JSP page.
+Pie Number of slices to send: Send
An error page should only be invoked as a result of the container detecting an uncaught exception. As such, you should be never be in a position to have to know whether it's an error page or not.

This and your other post regarding error pages leads me to suspect that you are using error pages in inappropriate ways, Perhaps you could explain to us what it is you are actually trying to accomplish and we can advise on the best ways to accomplish it.
[ July 02, 2007: Message edited by: Bear Bibeault ]
+Pie Number of slices to send: Send
I'm not sure whether you can findout whether the current page is error page or not by reading directive attributes.
I have one suggestion but I dont know whether it works or not? Use reflection mechanism to find all variables in jsp. If variable exception is defined in jsp then it is error page!!
I am wondering, what use case is making you to write that logic?
Anyway, best of luck.
+Pie Number of slices to send: Send
 

Originally posted by Rizwan Mohammad:
I'm not sure whether you can findout whether the current page is error page or not by reading directive attributes.
I have one suggestion but I dont know whether it works or not? Use reflection mechanism to find all variables in jsp. If variable exception is defined in jsp then it is error page!!
I am wondering, what use case is making you to write that logic?
Anyway, best of luck.



Before diving into reflection, I'd read Bear's post.
Let us know what you're trying to do.
Maybe we can suggest another approach.
+Pie Number of slices to send: Send
 

Before diving into reflection, I'd read Bear's post.
Let us know what you're trying to do.
Maybe we can suggest another approach.



I agree with you.
a wee bit from the empire
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1354 times.
Similar Threads
page directive import attribute
pageContext.forward
Repeated page directives
session problem
attribute in Page directives(jsp):confused:
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 00:47:29.