Solved

request.getParameter is returning null value

Posted on 2008-10-26
1
896 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
Check out this step-by-step guide for asking an anonymous question on Experts Exchange.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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