how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL

how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL

<html>
  <head>
    <title>online exam</title>
  </head>
  <body>
      <div align="center">
          <form method="post" action="Tab">
          <p>4.what is currency of USA?</p>
         <input type="radio" name="d"  onclick="getAnswer('a')" value="a "/>dollar &nbsp;
          <input type="radio" name="d" onclick="getAnswer('b')" value="b "/>pound &nbsp;
          <input type="radio" name="d"  onclick="getAnswer('c')"  value="c "/>rupees &nbsp;
          <input type="radio" name="d"  onclick="getAnswer('d')"   value="d "/>yen<br />
           </form>
           </div>
</body>
</html>

package src;

import java.io.*;
import java.net.*;
import java.sql.*;

import javax.servlet.*;

import javax.servlet.http.*;
public class Tab extends HttpServlet {
           protected void processRequest(HttpServletRequest request, HttpServletResponse response throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        int count=0,wrng=0;

         String radio0=request.getParameter("a");
         out.println(radio0);
        if("c".equals(radio0))
           count++;
        else
                wrng++;
          out.println("<html><head><title>result</title></head><body>" +
                "<div align=\"center\"><h1><u>Result</u></h1><p>correct answers are:</p>"+count+"<br/><p>wrong answers are :</p>"+wrng+"</div></body></html>");
        out.close();
    }


    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }


    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }


    public String getServletInfo() {
        return "Short description";
    }

}

Here the radio0 returns null value.pls advice me

View Answers









Related Tutorials/Questions & Answers:
how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL
how to access radio buttons selected in a servlet??...iam unable to retrieve values...it is returning NULL
Advertisements
Display Label and radio buttons runtime with respect to DB values
Java radio buttons and button groups two values
Java radio buttons and button groups two values
radio buttons
3 RADIO BUTTONS
How to save Selected text of RadioButton in to Access Databse - Java Beginners
pyspark dataframe drop null - how to drop row with null values
Radio Buttons in Jsp - JSP-Servlet
How to store JComboBox selected Item into Ms Access Database - Java Beginners
How to save JCombobox Selected Item in to Access Database - Java Beginners
Radio Buttons - Java Beginners
method returning null on JSP page.Plz HELP!!!
method returning null on JSP page.Plz HELP!!!
how to insert values from jsp into ms access
how to generate automatic bill based on selected values using jsp/javascript?
Selecting a Radio Button component in Java
disallow NULL values in a table.
How to access session values through Ajax?
access into radio button
pass radio button values to next page
how to retrieve data from table with runtime values in sql?
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
How to store two integer value in a separate file and retrieve those values
How to retrieve array values from html form to jsp?
How to read and retrieve jtable row values into jtextfield on clicking at particular row ...
PHP Returning Values from Function
retrieve multiple attribute values
retrieve multiple attribute values
retrieve multiple attribute values
Radio Buttons in DB Very Urgent - JSP-Servlet
WRITE A CODE IN STRUTS ACTION CLASS FOR CHECK BOXES AND RADIO BUTTONS - Struts
Form unable to hold values - Struts
how to display selected checkboxes dynamically using jsp
ModuleNotFoundError: No module named 'django-null-values'
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Tab sequence problem with Radio buttons - JSP-Servlet
when radio button is selected corresponding jsp page should open
Dynamically display values in dropdown box and then show the selected values as selected by the user which is already stored in the DB
ma access reading values
Dojo Radio Button
Retrieve value of radio button from database to form
ma access reading values
ModuleNotFoundError: No module named 'odoo10-addon-web-access-rule-buttons'
ModuleNotFoundError: No module named 'odoo11-addon-web-access-rule-buttons'
ModuleNotFoundError: No module named 'odoo9-addon-web-access-rule-buttons'
prog. using radio buttons for simple calculator
prog. using radio buttons for simple calculator
Inserting values into a database table of selected DropDown in jsp.

Ads