Results 1 to 2 of 2
  1. #1
    thenna is offline Member
    Join Date
    Aug 2013
    Rep Power

    Post Servlet request.getParameter() always return null value

    I'm working on simple client server communication using HttpPost. From the client side I'm setting a parameter(filename).

    At the server side when I try to get the parameter value it's always showing null. I tried using MultiPartEntity but even that is not working.

    Below is my client code:

    HttpPost httppost = new HttpPost("");
    InputStreamEntity reqEntity = new InputStreamEntity(
    new FileInputStream(dataFile), -1);

    // Send in multiple parts if needed

    //setting the parameter
    httppost.getParams().setParameter("filename", "xxxx.xml");
    HttpResponse response = httpclient.execute(httppost);
    int respcode = response.getStatusLine().getStatusCode();

    Below is my Servlet code:

    Scanner scanner = new Scanner(request.getInputStream());

    // reading the parameter
    String filename = request.getParameter("filename");
    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File("C:\\" + filename)));

    Kindly let me know any possible solution for this issue.

    Thanks in advance!
    Last edited by thenna; 08-27-2013 at 11:20 AM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Servlet request.getParameter() always return null value

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. problème jsp servlets getParameter null
    By JohnSheppard in forum Java Servlet
    Replies: 0
    Last Post: 05-15-2013, 12:20 PM
  2. Replies: 1
    Last Post: 10-22-2011, 05:50 AM
  3. dynamically generation of request.getParameter()
    By ras_pari in forum New To Java
    Replies: 12
    Last Post: 05-21-2010, 11:12 AM
  4. Replies: 0
    Last Post: 03-10-2010, 03:52 PM
  5. Help with request.getParameter()
    By Albert in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 07-13-2007, 03:39 PM

Tags for this Thread

Posting Permissions

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