File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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:
I agree. Here's the link:
subject: replacing scriplet in struts2 jsp page
It's not a secret anymore!