aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in Errata ; Thanks Cleared . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in Errata ; Thanks Cleared ." Watch "Doubt in Errata ; Thanks Cleared ." New topic
Author

Doubt in Errata ; Thanks Cleared .

Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557
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 ]

Thanks & Regards, T.Srinivasan
SCWCD 1.4(89%), SCJP 5.0(75%)
Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557
Ranchers.setFocus(this);
Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557
Please answer
Clifton Eaton
Greenhorn

Joined: Mar 26, 2007
Posts: 16
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.


-------------------------------------<br />SCJP<br />SCWCD
Srinivasan thoyyeti
Ranch Hand

Joined: Feb 15, 2007
Posts: 557
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

Joined: Mar 26, 2007
Posts: 16

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

Joined: Feb 15, 2007
Posts: 557
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.
 
 
subject: Doubt in Errata ; Thanks Cleared .