Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception object and EL

 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea anyone please?
 
nav katoch
Ranch Hand
Posts: 246
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone please help me to interpret the 6th option.
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Musab for prompt reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic