0

I am using Servlet. And request.getParameter() always returns null value even if the radio buttons are checked. Can anyone help?

This is my index.jsp page

<html>
<body>
<form action="FileLoader" method="post" enctype="multipart/form-data">
<p>
<label>
<input type="radio" name="se" value="pre-signing" checked = "checked">
Pre-signing </label>
<br>
<label>
<input type="radio" name="se" value="post-signing">
Post-signing </label>
</p>
</body>
</html>

This my servlet page

public void doPost(HttpServletRequest request,HttpServletResponse response)throws  ServletException, java.io.IOException {
String radioButton= request.getParameter("se");
System.out.println("radioButton ::"+radioButton);}

It returns me a null value even if the radio buttons are checked.

Abin Manathoor Devasia
  • 1,945
  • 2
  • 21
  • 47
user1990256
  • 23
  • 1
  • 3
  • Why have you enclosed `` inside a ` – Rohit Jain Jan 18 '13 at 11:59
  • possible duplicate of [How to upload files to server using JSP/Servlet?](http://stackoverflow.com/a/2424824/157882) – BalusC Jan 18 '13 at 16:06
  • @Rohit: it will put focus on radio button if you click on label text. – BalusC Jan 18 '13 at 16:06
  • @BalusC.. Oh! I thought surrounding it with – Rohit Jain Jan 18 '13 at 16:10
  • 1
    @BalusC.. I'm learning to work with Java EE 6, and I must say that your answers and blog are so much helpful, and I got to know things, that I can't get anywhere else. You're awesome. Cheers :) – Rohit Jain Jan 18 '13 at 16:13
  • @BalusC The question really doesn't sound as a duplicate of [How to upload files to server using JSP/Servlet?](http://stackoverflow.com/questions/2422468/how-to-upload-files-to-server-using-jsp-servlet/). Maybe the answer is the same, though. – rds Jan 18 '13 at 20:41
  • @BalusC Both these questions are poorly asked, when we see the answer... – rds Jan 18 '13 at 20:44
  • @Rohit : is that wrong? I am new to this.. Can you help me out – user1990256 Jan 19 '13 at 04:20

1 Answers1

1

since your encoding type is multipart.. your http request will not contain the information you need.

it will be available in the MultiPartRequest.. see this question.. it will help

Community
  • 1
  • 1
Anantha Sharma
  • 9,920
  • 4
  • 33
  • 35
  • 1
    O'Reilly `MultipartRequest` is prehistoric and is known to have some peculiar bugs (e.g. encoding). I really wouldn't recommend it nowadays. – BalusC Jan 18 '13 at 16:04