title: update table based on radio button selection using jsp
body: <p>i want to update a table based on radio button selection.i have a iframe,the table is displayed inside the iframe along with radio buttons,when i select a radio button a text area will be displayed in the parent page.now i want to update the table based on the radio button i have selected by entering the values in the text area generated by the radio button in the parent page.i tried my best and got null pointer exception.i have used javascript to display the textarea from iframe to parent page.</p>
  
  <pre><code>Design page:dailylog.jsp
  
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@ page import = "java.io.*,java.sql.*" %&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;script language="javascript"&gt;
          function showArea(data)
          {
           alert(data);
              document.getElementById("tt").value="";
  
              document.getElementById('textDesc').style.display='';
  
          }                       
          function hideArea()
          {
              document.getElementById('textDesc').style.display='none';
  
          }
     &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body onload="hideArea();"&gt;
      &lt;form target="if" action="dailylogdb.jsp" &gt;
          &lt;label&gt;Description&lt;/label&gt;&lt;br&gt;
          &lt;textarea cols="35" rows="8" name="ta" id="tt"&gt;&lt;/textarea&gt;&lt;br&gt;
          &lt;input type="submit" value="enter"&gt;
  &lt;!--            &lt;input type="text" name="txt" id="txtId"&gt;--&gt;
  &lt;/form&gt;
  
  
      &lt;form target="if"  action="dailylogdb.jsp"&gt;
      &lt;div id="textDesc"&gt;
  &lt;!--            &lt;input type="button" value="1234568"/&gt;--&gt;
          &lt;label&gt;Comments&lt;/label&gt;&lt;br&gt;
          &lt;textarea cols="35" rows="8" id="area" name="data" &gt;&lt;/textarea&gt;&lt;br&gt;
          &lt;input type="submit" value="enter" id="area1"&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  &lt;center&gt;
      &lt;iframe src="" name="if" width="600" height="350"&gt;&lt;/iframe&gt;
  &lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>backend :dailylogdb.jsp</p>
  
  <p>this script"function call(data)" will be passed to the parent page,it will call showarea and display the textarea and the button in parent page,this will happen when i click the radiobutton from the child's page.i need the value of the radio buttons in order to perform the row update.while page load,textarea with the name description will be displayed,the description is stored and the output is displayed in iframe with radio buttons.when we click the radbut a textarea with the name comment will be displayed in parent page and i need to update the comment based on radion button selection.how to get the value of radiobutton and perform update </p>
  
  <pre><code>  function call(data) 
    {
    parent.showArea(data);
    }
  
  &lt;table cellpadding="15" border="1"&gt;
      &lt;tr&gt;
          &lt;th&gt;Sno&lt;/th&gt;
          &lt;th&gt;Time&lt;/th&gt;
          &lt;th&gt;Date&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
          &lt;th&gt;Comments&lt;/th&gt;
          &lt;th&gt;Select&lt;/th&gt;
      &lt;/tr&gt;
  
     &lt;%
     while(rs.next())
             {
  
      %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%=rs.getString("sno") %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%=rs.getString("Time") %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%=rs.getString("Date") %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%=rs.getString("Description") %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%=rs.getString("Comments") %&gt;&lt;/td&gt;                          
          &lt;td&gt;&lt;input type="radio" id="my" name="rad" onclick="call(&lt;%=rs.getString("sno")%&gt;);" value="&lt;%=rs.getString("sno")%&gt;"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  
  &lt;%  
  
  }    
  %&gt;
    &lt;/table&gt;
  </code></pre>