Solved

request.getParameter is returning null value

Posted on 2008-10-26
1
888 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Servlet Login session time and authentication using Filter 6 71
maven project in eclipse 11 60
maven webservice example issue 2 144
Books that can get me started on JAVA 2 105
The advancement in technology has been a great source of betterment and empowerment for the human race, Nevertheless, this is not to say that technology doesn’t have any problems. We are bombarded with constant distractions, whether as an overload o…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 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