• 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

Doubt in Errata ; Thanks Cleared .

 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi WCD Sailors,

Source: http://www.oreilly.com/catalog/headservletsjsp/errata/headservletsjsp.confirmed
[432] Question 17, Option C;
option C is invalid and should not be checked.

Option C:
if the .(dot) operator is used to access a bean property but the property doesn't exist, then a runtime exception is thrown.


"Why Option C was corrected invalid ?"

[ April 16, 2007: Message edited by: Srinivasan thoyyeti ]

[ April 16, 2007: Message edited by: Srinivasan thoyyeti ]
[ April 17, 2007: Message edited by: Srinivasan thoyyeti ]
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranchers.setFocus(this);
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please answer
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to JSP 2.0 spec on page 1-69 if the parameter following the dot operator is not a readable property of the bean, it causes an error.

After testing, calling a property that does not exist on the bean causes an ELException which is a checked exception, NOT a runtime exception, hence the correction.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Clifton Eaton,

JSP FILE
<jsp:useBean id="per" type="sri.wcd.Person" class ="sri.wcd.Person" scope = "request"><BR>
</jsp:useBean><BR>
Person Name:<jsp:getProperty name="per" property="name"/>
${per.empID}
//per.empID is causing a runtimeexception
INPUT
http://localhost:9080/ProjectOne/view1.jsp?name=srinivasan&empID=1234533

OUTPUT
AT SERVER:
SRVE0026E: [Servlet Error]-[/view1.jsp]: javax.servlet.jsp.el.ELException: Unable to find a value for "empID" in object of class "sri.wcd.Person"
using operator "."

AT BROWSER:

ERROR 500.

JSP.2.3.3 Errors, Warnings, Default Values
JSP pages are mostly used in presentation, and in that usage, experience suggests that it is most important to be able to provide as good a presentation as possible, even when there are simple errors in the page. To meet this requirement, the EL does not provide warnings, just default values and errors. Default values are typecorrect values that are assigned to a subexpression when there is some problem. An error is an exception thrown (to be handled by the standard JSP machinery).[/QUOTE]

What does it mean to say : to be handled by the standard JSP machinery
Any body please responde.

 
Clifton Eaton
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


OUTPUT
AT SERVER:
SRVE0026E: [Servlet Error]-[/view1.jsp]: javax.servlet.jsp.el.ELException: Unable to find a value for "empID" in object of class "sri.wcd.Person"
using operator "."

AT BROWSER:

ERROR 500.



The exception that is being thrown at the server, is ELException which is not a runtime exception, take a look at the javadoc for ELException and you will see it inherits from Exception, not RuntimeException.
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Clifton Eaton,

java.lang.Object
java.lang.Throwable
java.lang.Exception
javax.servlet.jsp.el.ELException
ELException is not RuntimeException.

Hence,

if the .(dot) operator is used to access a bean property but the property doesn't exist, then a runtime exception is thrown.



is wrong statemet.
Thanks a lot.
reply
    Bookmark Topic Watch Topic
  • New Topic