Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java Servlets n stuff

Options
  • 03-05-2002 10:58am
    #1
    Closed Accounts Posts: 536 ✭✭✭


    I've a Java application which queries a HTTPServlet to get it's information.
    I've no problem getting huge chunks of data from the Servlet to the app but I'm stumped when I try to reverse it, i.e send chunks of data either in binary form or in String form, doesn't really matter to to the HTTPServlet.

    I've feck all experience when it comes to servlets either.
    (One of the other lads here wrote the servlet and I'm just trying to adjust it to what I want it to do)

    The following is what I do on the client side when I want to send an query How do I alter this to send data across also. And how do I handle it on the server side?


    URL myURL = new URL("http://localhost:8080/servlet1?query="+query+"");
    URLConnection con=myURL.openConnection();
    con.setDoOutput(true);
    con.setDoInput(true);
    PrintWriter out=new PrintWriter(con.getOutputStream());
    out.close();
    BufferedReader in=new BufferedReader(
    new InputStreamReader(con.getInputStream()));



    Any help here would be great.


Comments

  • Registered Users Posts: 6,661 ✭✭✭Blitzkrieger


    Not sure I understand the problem. How are you retrieving the data from the query?

    String query = request.getParameter( "query" ); would put the contents of the query sent with the get/post request into the string.

    For sending large amounts of data wouldn't it be better to have the recieving servlet read it from a file instead?


Advertisement