• 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

<c:catch> will work only for runtime exceptions?

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

I studied about <c:catch> tag and tried a program.
Here's the snippet


<c:catch>
<%@ include file = "test.jsp" %>
</c:catch>
This test will appear if catch works

I expected that catch will work but it didn't.

then I tried with <jsp:include > and <c:import > and it worked
as I expected .

later I understood that include directive will be translated
during compile itself where as the other two(standard action and jstl tag)
will be translated at runtime and that's why catch didn't
work for "include standard action" which has been stopped by
container even before the translation

What I understood is right ?

Thanks in advance







 
Ranch Hand
Posts: 437
Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Parthiban.

I think, c:catch will works for include files also.
Inorder to test wether it works or not? Add some exception generated code in 'test.jsp' and test like
 
Parthiban Malayandi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chinmaya,

Thanks for your reply and I tried as you said and <c:catch> works for include directive also.

I also learned that if that jsp page(e.g test.jsp) itself
doesn't exists means it didn't works rather it throws file not found exception since it is trying to include content of the file (test.jsp)during translation time itself .
where if we use include standard action or import jstl tag .it compiles fine and it's trying to include the content only at request (run time )time which is caught by <c:catch> tag .

once again thanks for your reply .
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic