Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is there any Compulsory to give the try /catch in jsp page.

 
Ramasubramaniam Rathinasubbu
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any Compulsory to give the try /catch in jsp page.
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to accomplish and what are the situations, where you except an exception to be thrown.

As a rule of thumb, avoid any java code or scriptlets in jsp and instead use custom tags.

using try/catch in jsp is a bad design. Instead put all your java logic in a bean or custom tags and handle the exception in those classes instead of jsp.

But, what are the situations you expect an exception be thrown in jsp.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. In fact, since you should have no Java code in a JSP page, there's no need for try/catch.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic