Search code examples
javasocketsweb-applicationsservletsbusiness-logic

how to work with servlet and business layer?


I have a java application:

a. server side - Swing application (i created a gui for the server with jTextArea, just to print the client requests)

b. client side - Swing application

in the server side i have the business layer which store data in some vectors.

now, in addition to the Swing application in the client side, i need to create a web application, which need to represent the same data from the vectors in the bl.

my question is, if i open a new web project, how can the servlet will get the data from the bl, because it's different project.. is it possible that my server side will listening to requests from the servlet? is it possible that they(the servlet and the server(a) ) will communicate via sockets?


Solution

  • I think the best way is to create a new Web Project. In the Gui of the web page to have some buttons.. and when some button was clicked I'll redirect him to the servlet. Now the Servlet will communicate with the Server side via sockets, to get the data about the BL. when the servlet recieve this data, I'll create a new Web page and show the data.