This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes exception object and EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "exception object and EL" Watch "exception object and EL" New topic
Author

exception object and EL

Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
I got this question:

A JSP page myerror.jsp has been invoked as a result of an exception from another JSP page. How can you print the message contained in the exception instead of displaying the whole stack trace in myerror.jsp?
(choose 2 answers)
1. ${exception.getmessage}
2. ${exception.message}
3. ${request.exception.message}.
4. ${exception.errorMessage}
5. ${pageContext.exception.message}
6. ${requestScope["javax.servlet.error.exception"].message}


I thought that 2 would be one of the answers yet the correct answers are 5 and 6.

If 5 is correct doesn't that make 2 also correct?
any comments on the correct answers?

Thanks in advanced.


SCBCD - SCWCD - SCJD - SCJP - OCA
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
Any idea anyone please?
nav katoch
Ranch Hand

Joined: May 02, 2008
Posts: 246

Which book are you studying for this exam? If HFSJ 2nd edition, refer page 385.
Identify whether it is a jsp implicit variable or an EL implicit object.

Thanks, Naveen.
raja ram
Ranch Hand

Joined: Mar 02, 2008
Posts: 169
Hi,

Yes 5 and 6 are correct 2 is not correct because ELImplicit object are different and JSP implicit Objects are different so.

All the ELImplicit Objects are Maps they do not have access to Actual instance of the request,response and so on they have access only to attributes. so the only common implicit object for EL and JSP is pageContext which is a bean through which the EL can access other implicit objects of JSP because pageContext intern has refrences to other JSP implicit Objects.

Thanks
Abhishek Kanchan
Ranch Hand

Joined: May 10, 2007
Posts: 32
Hi,

Can anyone please help me to interpret the 6th option.
Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
An attribute with the name javax.servlet.error.exception is added to the request scope which has properties about the exception, one of these properties is the exception message.
Abhishek Kanchan
Ranch Hand

Joined: May 10, 2007
Posts: 32
Thanks Musab for prompt reply.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: exception object and EL
 
Similar Threads
Transactions & Exception doubt 2
handle exception in servlet
Unexpected Error Logging
implicit objects are available to the jsp page
using ${exception.message}