views:

65

answers:

1

I am getting null when I am using post method while passing a form to the next page A repeat of this question link text

<html>
<head>
Title
<script>
function callme()
{        
alert("Hi");         
alert(document.getElementById("prio").value);    
}
</script>   
</head>
<body>
<FORM method="post" name="test"enctype="multipart/form-data" action="testjsp.jsp" >
<select name="prio" id="prio"> 
<option>1</option>
<option>2</option>
</select>
<input type="submit" value="Submit" onClick=callme();>
</form>
</body>
</html>

IN testjsp.jsp I am trying to prin the prio variable which I am not able to do and its prining null.I just want to access the variable prio in some other server side component and also want to use post method.

<html>
<head>
Title  
</head>
<body>
<%
String prio=request.getParameter("prio");
out.println("the value of prio is"+prio);
%>

</body>
</html>

Is this any way related to Idempotent property? I am confused why I could not access the variable prio in the testjsp page.

+1  A: 

You are encoding your request as multipart/form-data, often used to upload files. The servlet container does not include support to automatically decode this data, only application/x-www-form-urlencoded data (the default). To use multipart/form-data you need a 3rd party MIME parser like Apache commons fileUpload.

McDowell