问题
We are evaluating one design for educational activity. We would like to create complete backend (which handles business logic) in form of RESTful web services. These services can be used by various apps. Is it good idea to call these web services from Struts2 framework? I read couple of docs, and people discourage it.
We would love to go with Struts2 as team is quite strong on it. But if its bad approach, we may consider for other options.
回答1:
If you want to leverage development on presentation layer between client-side and server-side (this is where Struts2) then you can utilize web services using a web services client API. At this point these web services can be used as data resources.
If you want to stay only on client-side then you don't need any server-side framework for the frontend development.
Note that The introduction to Struts2 and RESTful applications you have posted in comment introduces an alternative way instead of web services for creating backend in a form of RESTful API using Struts2 framework.
Using Struts2 for the REST instead of web services could be a solution for RAD (Rapid Application Development). Because web services are very complicated technology that used in upper high level architectures and using some alternative resource APIs might be cost effective.
来源:https://stackoverflow.com/questions/26300711/restful-web-services-and-struts-2