• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

exception object and EL

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any idea anyone please?
 
Ranch Hand
Posts: 246
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Musab for prompt reply.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic