• 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic