1 Reply Latest reply on May 13, 2005 3:52 PM by mjchecko

    Returning Parameters to a Client

    mjchecko

      I am running an HttpServlet that accepts POSTs from client programs. The POST data is validated against the database, and return values need to be transmitted back to the client to continue operations.

      The POST data is being received by the JBoss port 8080 connector just fine, and the servlet is processing the data against the database just fine. The problem is returning the values back to the client in the HTTP stream. Right now, I am only sending back an HTTP-200/OK, without my authentication parameters.

      I have tried the following, with no success:

      return <variable>;
      System.out.println (<variable>);
      System.out.print (<variable>);



      I also wrote the following simple object with no success --

      public void setReturnValues ( String value ) { vtr = value; }
      
      public String getReturnValues()
       { System.out.print (vtr);
       System.out.println (vtr);
       return vtr;
      }



      Any ideas on what I am doing wrong? All of this compiles correctly, except for the "return ;" command in the main program flow.

      Sorry if this is remedial, I am relatively new to java and jboss.

      Thank you,

      - Matt

        • 1. Re: Returning Parameters to a Client
          mjchecko

          I figured out the problem, I wasn't doing anything with the values returned. I needed the following:

          response.setContentType( "text/html" );
          PrintWriter out = response.getWriter();
          out.println( <variable> );


          Hope this helps someone else one day.

          - Matt