Solved

Posting Data from Form - But all fields are null when processing

Posted on 2004-07-30
4
239 Views
Last Modified: 2010-04-01
I am submitting the following form:
<form name="mainForm" method="post" action="index.jsp" enctype='multipart/form-data'>

with this submit button:
<input name="submit_form" type=submit value="Save" onClick="javascript:document.mainForm.submit();">

But when I get to the processing page, all of the field variables are null, for example:
<%
   String $subtitle = request.getParameter("subtitle"); //This is a field in the form
   out.println(" Subtitle_index=" + $subtitle);
   String $submit_form= request.getParameter("submit_form"); //This is the actual submit button
   out.println(" SubmitButton=" + $submit_form);
%>
Returns: "Subtitle_index=null SubmitButton=null"

I have temporarily changed the method to get, and all of the values in the fields show up in the URL, but when I make the method post, I get back a bunch of nulls.  

Am I missing something simple here?

Thanks,
Michael
0
Comment
Question by:mderbin
4 Comments
 
LVL 2

Expert Comment

by:k41d3n
ID: 11681567
Use get not post.

You are getting the values froma  post. not posting values from a  post.
0
 

Author Comment

by:mderbin
ID: 11682538
But I wasn't wanting all of the data to be displayed in the URL, and it has the potential to be VERY long, so the characters in the URL will certainly run over at times.  

So I was under the impression that I would need to use a "post" method in my form.
0
 
LVL 27

Accepted Solution

by:
rrz earned 50 total points
ID: 11682592
>enctype='multipart/form-data'  
If you use that then you need necessary code at server to parse the multipart request.  You could use  
http://jakarta.apache.org/commons/fileupload/     
Are you uploading a file  ?
0
 
LVL 4

Expert Comment

by:Oliver_Dornauf
ID: 11704282
The input type submit or button have no _value_ you c! If you use java script to submit your form (i.e you need multiple submitt buttons or do some client side validation) you should use the input type button.


0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Set up Wildfly 10 8 394
best tutorial on log4j and logging for servlets/jsp codes 1 64
Spring MVC - sending raw charset to backend 3 199
login jsp example 24 48
Read about the ways of improving workplace communication.
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

770 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