I develop a CRUD Spring, Servlet/JSP application. I will develop a desktop Swing application with same functionality. My question is that possible to communicate and resuse servlets on swing application (not applet)?
Asked
Active
Viewed 1,228 times
3 Answers
4
Yes, by making http requests. You can do them with multiple tools. Two of them:
new URL(..).openConnection()
- apache http components
- since you tagged spring, if you are using it with swing, you can use its
RestTemplate
. It's used to invoke restful services. You can expose your logic as restful services through the servlets (or spring-mvc), and consume them withRestTemplate
2
The Rest idea above is pretty good. In fact, by using Spring and it's proxies, you could use any kind of webservices (RESTFul or WSDL), and Spring would make it transparent for you.
Please check some examples in the Spring manual. Take a look at how to create proxies using service interfaces.
Best regards.

ThiagoUriel
- 115
- 6
1
since its all via HTTP, and mechanism as suggested above can work. Or you can even open bytestream to the server and read/write using that stream.

Akshat
- 4,515
- 4
- 27
- 28