Solved

request.getParameter is returning null value

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSP call a method on a session attribute which is an object 2 61
logging jar 1 106
java cyclic graphs 15 201
best way to search/remove a file from an EAR file 3 102
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

19 Experts available now in Live!

Get 1:1 Help Now