This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Struts and the fly likes replacing scriplet in struts2 jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "replacing scriplet in struts2 jsp page" Watch "replacing scriplet in struts2 jsp page" New topic

replacing scriplet in struts2 jsp page

ganta gopal

Joined: Feb 05, 2009
Posts: 15

I have scriptlet in a jsp which is actually using try/catch (exception handling ) .so i want to convert this jsp page into struts2 jsp page .so how to handle the exception handling scriptlet scenario

David Newton

Joined: Sep 29, 2008
Posts: 12617

What are you doing in your JSP that can throw an exception?

Normally all complex operations are carried out in Java code.
Roberto Hernandez
Ranch Hand

Joined: Apr 29, 2009
Posts: 33
I agree with David that all complex operations should be handled in Java classes. Also, don't use scriptlets in JSP, use JSTL tags for cleaner code. If you really need to catch an exception in a JSP, you can use JSTL c:catch tag.
For example:
Have you checked out Aspose?
subject: replacing scriplet in struts2 jsp page
jQuery in Action, 3rd edition