Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 9th, 2004, 09:34 AM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default connecting a Swing client to an existing servlet a

Hi,

first, sorry for my poor english..


I would like connect my Swing app (when i click on a button) to a servlet

schéma:

1. swing ( pass parameters to a servlet )
2.servlet => call stocked procedure in oracle
          => generate xml
3.report in a browser after processing xml via xlst

Have you some code to propose to me ??

Thanks

 
Old June 17th, 2004, 05:33 PM
Registered User
 
Join Date: Jun 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Some basic code to start with. You can also use serialization with ObjectInputStream.


    public String talkToServlet() {
        StringBuffer response = new StringBuffer();
        String line = null;
        try {
            URL url = new URL("http://www.website.com/servlet/ServletName");
            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
            while ((line = in.readLine()) != null) {
                response.append(line + "\n");
            }
            in.close();
        } catch (Exception e) {
            return "error";
        }
        return response.toString();
    }

S. Densmore (SCJP)





Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting client to client (Socket programming) maricar C# 0 September 25th, 2008 04:34 AM
Connecting existing program to SQL Express DB jscammell VB Databases Basics 2 April 19th, 2007 02:03 PM
Swing Servlet Communication ? ? ? nigam.anand Servlets 0 April 22nd, 2006 02:27 AM
Send file from Servlet to Client End (Swing) nigam.anand Servlets 0 April 22nd, 2006 02:22 AM
sending a file from swing client to servlet sid_ Servlets 0 March 2nd, 2005 05:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.