File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Errata ; Thanks Cleared .

 
Srinivasan thoyyeti
Ranch Hand
Posts: 557
  • 0
  • Mark post as helpful
  • send pies
  • 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: 557
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ranchers.setFocus(this);
 
Srinivasan thoyyeti
Ranch Hand
Posts: 557
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please answer
 
Clifton Eaton
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • 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: 557
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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: 557
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic