This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Clarification Required

 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:catch var="a">
<%throw new ArithmeticException();%>
</c:catch>


Got an error 'Unreachable statement'.

c:catch could'nt catch this exception..WHY?
Request anyone to clarify.

Thanks
 
Gab Buda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vinod,

(how come you're not yet banned on the forum with such an unrealistic last name? )

regarding your jsp, that's NOT a jstl problem.
If you put in your jsp only this code (I did it for you):


<BODY>
<%throw new ArithmeticException();%>
</BODY>



in the generated servlet _jsp.java you got (in the _jspService method):

out.write("<BODY>\r\n");
throw new ArithmeticException();
out.write("\r\n");
out.write("</BODY>\r\n");


and this will NOT compile because the compiler detects that the code after the throw statement is unreachable. You'll get this in any java class (with the recent compilers), this has nothing to do whith <c:catch>

The <c:catch> will catch the execution errors/exceptions, but this is a compilation one.

Hope this helps
gabb

[ April 04, 2006: Message edited by: gabb buda ]
[ April 04, 2006: Message edited by: gabb buda ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what is unrealistic about the name, but even still it does not follow the proper format presented by the Javaranch naming policy.

After reading the policy, you can change your display name here.
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
 
Elias N Varghese
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!