All the Java code in a servlet -- every line of it -- runs on the server. None of it runs on the client. A servlet's only "GUI" is HTML. You can't put Swing code in a servlet. If you need to have Java code run on the client, then you need to use either an
applet that can be embedded in the servlet's HTML output, or a separate Swing application that the user needs to install separately; either of these would have to explicitly communicate with the server via HTTP.
Since your followup questions are all going to relate to servlet application architecture, and aren't really I/O related, I'm going to move this to our "servlets" forum.