问题
If you want to migrate Struts1 to Struts2, you can leave the JSP implementation in Struts1 and rewrite the action class in Struts2?
Can you add in web.xml
both configurations for Struts1 and Struts2?
回答1:
You have to rewrite both action classes and JSP, however you can reuse your business services if they are exist on the service layer. The same is for persistence layer.
Note, if you can leave JSP implementation, then you should replace them with something that will work on the view layer. It could be html, javascript, another templating framework like freemarker or velocity. It could be SPA, or MPA application that communicates with the server via HTTP or web sockets. It's up to you how do you architect your application. Struts can parse usual HTTP requests (GET/POST) and REST with support of the plugin. A lot of plugins exist to help you to better use the framework.
Struts1 is too old and can't work with the latest Struts2 because they have mismatch of dependencies of different versions. You should just leave Struts1 and migrate it to Struts2. It's straightforward process that takes less time rather that rewriting to another framework like Spring MVC.
If you need more information about the migration process you can read this answer. However, a lot of information and code is already outdated comparing to the latest version of Struts and might not work the ideas remain the same.
来源:https://stackoverflow.com/questions/42580831/struts1-to-struts2-migration-strategy