Results 1 to 2 of 2

Thread: doPost question

  1. #1
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    8

    Default doPost question

    Can you help me with this sample?

    Java Code:
    void doPost(HttpServletRequest arg0, httpServletResponse arg1) throws ServletException, IOException {
    InputStream in=arg0.getInputStream();
    byte[] b=new byte[50];
    in.read(b);
    for(byte i : b){
    System.out.println(i) ;
    }
    }
    I post a parameter such as "for=12345" through a form,but above code can not read byte from stream. I change the code as
    Java Code:
    InputStreamReader isr = new InputStreamReader (in);
    BufferedReader br = new BufferedReader (isr);
    System.out.println(br.readLine()) ;
    it prints "for=12345"
    why??

  2. #2
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Posts
    130
    Rep Power
    0

    Default

    You shoulde get it by the following code:
    Java Code:
     arg0.getParameter("for")

Similar Threads

  1. Question mark colon operator question
    By orchid in forum Advanced Java
    Replies: 9
    Last Post: 12-19-2010, 09:49 AM
  2. JSP Question
    By maheshkumarjava in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 03-29-2008, 11:51 AM
  3. Setting cookie from doPost
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-25-2008, 08:08 PM
  4. About doGet & doPost methods
    By amitnayak1 in forum Java Servlet
    Replies: 3
    Last Post: 12-04-2007, 08:02 AM
  5. question about rmi
    By leonard in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 05:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •