Solved

request.getParameter is returning null value

Posted on 2008-10-26
1
872 Views
Last Modified: 2010-05-18
Hi

My code: request.getParameter is returning null value

String Name = request.getParameter("txtName");

Name = null


<form name="form1" method="post" action="fire" enctype="multipart/form-data">

<input type="text" name="txtName" value="">

<input type="file" name="image1">

<INPUT type="image" src="/update.gif">

Open in new window

0
Comment
Question by:techques
1 Comment
 
LVL 27

Accepted Solution

by:
rrz earned 50 total points
ID: 22809707
You should use the org.apache.commons.fileupload   API for  a multipart form.
Here is an example.
http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_23504709.html
For your here, you could use something like  
                 
  boolean isMultipart = ServletFileUpload.isMultipartContent(request);

  if(isMultipart){

                  ServletFileUpload upload = new ServletFileUpload();

                  FileItemIterator iter = upload.getItemIterator(request);

                  FileItemStream item = null;

                  String name = "";

                  InputStream stream = null;

                  while (iter.hasNext()){

                                         item = iter.next();

                                         name = item.getFieldName();

                                         stream = item.openStream();

                    if(item.isFormField()){

                        if{"txtName".equals(name){

                                out.println("txtName is" + Streams.asString(stream) + "<br/>");

                        }

                    }

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now