如何从 Swing 通信 Servlet [英] How can I communicate Servlet from Swing

查看:28
本文介绍了如何从 Swing 通信 Servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个 CRUD Spring、Servlet/JSP 应用程序.我将开发一个具有相同功能的桌面 Swing 应用程序.我的问题是可以在 Swing 应用程序(不是小程序)上通信和重用 servlets 吗?

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)?

推荐答案

是的,通过发出 http 请求.您可以使用多种工具来完成它们.其中两个:

Yes, by making http requests. You can do them with multiple tools. Two of them:

  • <代码>新 URL(..).openConnection()
  • apache http 组件
  • 因为你标记了spring,如果你在swing中使用它,你可以使用它的RestTemplate.它用于调用宁静的服务.您可以通过 servlet(或 spring-mvc)将您的逻辑公开为 Restful 服务,并使用 RestTemplate
  • 使用它们
  • 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 with RestTemplate

这篇关于如何从 Swing 通信 Servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆