How do I add a servlet to replace scriptlets in a JSP?
This question already has an answer here:
If i understood the scenario completely,
Steps:
You could send the control to the Servlet instead of the jsp directly. ie you will have to change the url slightly to point to Servlet not to the jsp.
Let the Servlet pre-process the request parameters (and some business logic if required)
The Servlet then forwards the request to the jsp which finally renders the view.
That should work, as the only change to the existing application is a slight url change.
Caution: Hoping you have tests which test this part of the application !
链接地址: http://www.djcxy.com/p/76602.html