Radio button options in Servlet

I am trying to develop radio buttons in a servlet program. The program is supposed to update a database using the radio button options . I am having problem with the program compiling after I add radio buttons.
When compile the program, I receive an error message: " The local variable Level is never read"
please tell me what I am doing wrong in the following code:
private void sendUpdateForm(HttpServletRequest request, HttpServletResponse response)
         throws IOException {
            String ID = request.getParameter("ID");
              PrintWriter out = response.getWriter();
              out.println("<BR><H2>Update Form</H2>");
              out.println("<BR>Please edit the name.");
              out.println("<BR>");
              try {
                String sql = "SELECT Name_of_Officer, Title," +
                  " Level," +
                  "Multiply_View, " +
                  " FROM tDATA.users6" +
                  " WHERE ID=" + ID;
                Connection conn = DriverManager.getConnection(dbUrl);
                Statement s = conn.createStatement();
                ResultSet rs = s.executeQuery(sql);
                if (rs.next()) {
                   int Level = rs.getInt(1);
                  String Multiply_View = rs.getString(2);
                      out.println("<BR><FORM METHOD=POST ACTION=Resultpage>");
                  out.print("<INPUT TYPE=HIDDEN Name=ID VALUE=" +ID + ">");
                  out.println("<TABLE>");
                  out.println("<TR>");
                  out.println("<TD>Level</TD>");
                  out.print("<BR><INPUT TYPE=RADIO " +
                            "Name=Levels CHECKED VALUE=1>RC Manager" +
                         "<BR><INPUT TYPE=RADIO " +
                  "Name=Levels VALUE=2>Group Manager");
                out.println("></TD>");
                  out.println("</TR>");
                  out.println("<TD>Multiply View  </TD>");
                  out.print("<TD><INPUT TYPE=TEXT Name=Multiply_View");
                  out.print(" VALUE=\"" + (Multiply_View) + "\"");
                  out.println("></TD>");
                  out.println("</TR>");
                  out.println("<TR>");
                  out.println("<TD><INPUT TYPE=RESET></TD>");
                  out.println("<TD><INPUT TYPE=SUBMIT></TD>");
                  out.println("</TR>");
                  out.println("</TABLE>");
                  out.println("</FORM>");
                s.close();
                conn.close();
              catch (SQLException e) {
                out.println(e.toString());
              catch (Exception e) {
                out.println(e.toString());
       void updateRecord(HttpServletRequest request,   HttpServletResponse response)
         throws IOException {
         String ID = request.getParameter("ID");
         int Level = Integer.parseInt(request.getParameter("Levels"));
         String Multiply_View = request.getParameter(("Multiply_View"));
         PrintWriter out = response.getWriter();
         try {
           String sql = "UPDATE tDATA.users6" +
             " SET Level ='" + (Level) + "'" +
           " Multiply_View='" + fixSqlFieldValue(Multiply_View) + "'" +
          " WHERE ID=" + ID;
           Connection con = DriverManager.getConnection(dbUrl);
           Statement s = con.createStatement();
           int i = s.executeUpdate(sql);
           if (i==1)
             out.println("Record updated");
           else
             out.println("Error updating record");
           s.close();
           con.close();
         catch (SQLException e) {
           out.println(e.toString());
         catch (Exception e) {
           out.println(e.toString());

When compile the program, I receive an error message:
" The local variable Level is never read"
if (rs.next()) { // begin if then block scope
                        // ** Level delcared as local variable of type int
                   int Level = rs.getInt(1); // ** does this get used ???
                  String Multiply_View = rs.getString(2);
                      out.println("<BR><FORM METHOD=POST ACTION=Resultpage>");
                  out.print("<INPUT TYPE=HIDDEN Name=ID VALUE=" +ID + ">");
                  out.println("<TABLE>");
                  out.println("<TR>");
                  out.println("<TD>Level</TD>");
                  out.print("<BR><INPUT TYPE=RADIO " +
                            "Name=Levels CHECKED VALUE=1>RC Manager" +
                         "<BR><INPUT TYPE=RADIO " +
                  "Name=Levels VALUE=2>Group Manager");
                out.println("></TD>");
                  out.println("</TR>");
                  out.println("<TD>Multiply View  </TD>");
                  out.print("<TD><INPUT TYPE=TEXT Name=Multiply_View");
                  out.print(" VALUE=\"" + (Multiply_View) + "\"");
                  out.println("></TD>");
                  out.println("</TR>");
                  out.println("<TR>");
                  out.println("<TD><INPUT TYPE=RESET></TD>");
                  out.println("<TD><INPUT TYPE=SUBMIT></TD>");
                  out.println("</TR>");
                  out.println("</TABLE>");
                  out.println("</FORM>");
}// **end if then block scopewas Level intended to be a local variable ?

Similar Messages

  • Processing report in background with a radio button option

    Hi all,
    We have a requirement where we need to run report output as background job,
    where we need to give radio button option in selection screen for background run and manual run .
    Thanks
    Karthik

    Hi,
    so depending upon the radio button selected you can run the job in background or manually.
    if rb_bkgd = 'X'.
        <write a perform to make it run in background please refer this link for background job>
        <a class="jive_macro jive_macro_message" href="" __jive_macro_name="message" modifiedtitle="true" __default_attr="3050646"></a>
    elseif rb_frgd = 'X'.
         <write a perfrom which will make the report run in normal way>
    endif.
    Regards,
    Neha

  • Radio Button Options

    I'm using Mac Pro 9.5 to edit a fillable PDF form. We have radio buttons for payment choices. I need another field to automatically fill with a fee if a certain radio button is selected. Is this possible, and if so, how do I do it?

    In the case of the LDRP, that is the only option in the group. With the billing option group there are two buttons—"Paying full amount now" and "Paying half amount now". In this case we want only one selection and if they choose the paying half now option, then we want the $30 billing fee to show up in the fee box.
    Would you recommend I use check boxes instead of radio buttons? I tend to use check boxes when we offer multiple responses in a group. I use radio buttons when we want an exclusive response within a group of options.
    I just need to know how to get a radio button or check box selection to automatically fill a corresponding text box with the appropriate fee.

  • Hide/Active web items on select radio button options

    Hi Experts,
    If I click radio button select option A then hide X drop box  and active Y drop box and if I select option B(in radio button) then Y drop box get hide and X drop box get Active.
    How I can do this in WAD
    Please provide the solution ASAP
    thanks
    take care
    vishal sharma

    Hi.
    It is not possible when you use RADIO BUTTON.
    BUT possible if you use regular BUTTON GROUP - you may use SET_ITEM_PARAMETERS and set property VISIBLE to ON/OF as you need.
    Regards.

  • Radio button on a from generated with PL/SQL procedure

    Hi,
    I have a form generated with PL/SQL procedure. This procedure calls another procedure on 'Submit'. If I select value for the radio button, it works fine. But if no value is given to the radio button on the form, it gives error. Is the radio button mandatory field by nature? or do I need to give default value some how? How do I make the radio button optional? so that I can call the next procedure without passing the param.
    Create or Replace PROCEDURE OBM_PROCEDURE
    htp.formOpen(OWA_UTIL.GET_OWA_SERVICE_PATH || 'process_obm');
    htp.Print('Admin ');
    htp.FormRadio('p_access_level','A');
    htp.Print('Doc ');
    htp.FormRadio('p_access_level','D');
    htp.formSubmit(cname=>'p_button', cvalue=> 'Submit');
    =================================================================
    Create or Replace PROCEDURE PROCESS_OBM
    (p_access_level VARCHAR2,
    p_button VARCHAR2)
    htp.Print('p_access_level ');
    Thanks!

    Hi
    The parameters of the called procedure should have defualt values like this
    create or Replace PROCEDURE PROCESS_OBM
    (p_access_level VARCHAR2 default 1,
    p_button VARCHAR2 default null
    htp.Print('p_access_level ');
    Thanks,
    sharmila

  • Autofill a radio button using other radio buttons

    I would like a question on my form "Q24 Decrease Smoke" (set of "Yes"/"No" radio buttons) to auto fill with a response of "No" if the user selects "Not at all" to 3 other questions (also sets of radio buttons).  If the user selects any other response to any of these 3 questions, I want the user to be able to manually select either "Yes" or "No". This is the code that I've tried, under the Mouse Up event of the "No" radio button option for Q24:
    var a = getField("Q20 Smoke Cig").value;
    var b = getField("Q22 Smoke other forms").value;
    var c = getField("Q23 chew/snuff").value;
    if(a=="Not at all" && b=="Not at all" && c=="Not at all") event.value = "On";
    I'm new to Javascript, so am not entirely sure I am on the right track or what might be wrong here. Any help would be greatly appreciated. Thanks!

    Have you tried to the set the value to to "No"?
    The "Mouse Up" action only works when there is a "Mouse Up" action for the field.
    I would look at using the script in the 'On Blur" action for the 3 fields with adjustments for the fields as needed for the field where the script is used.

  • Disabling Radio Button Conditionally is not working Well

    Hi friends,
    I have three radio buttons
    <li>self
    <li>New Hire
    <li>On Behalf of
    I will be showing this radio button conditionally according to the user who logs into the application.
    Assume, suppose if a person 'A' enters into the application means he will be shown only these radio button options ---NH---,----OB----,----Self-----
    Suppose, if a person 'B' enters into the application means he will be shown only these radio button options ----NH----,----Self---
    If a person 'C' enters into the application means he will be shown only these radio button options ---Self---
    I have restricted those radio buttons according to the users who enter into the application using their roles.
    But my challenge here is once the user logged in and if he select anyone of the radio button means,
    Example if he selects----NH---means, then ---OB----and -----Self---radio button has to disable and if he selects ---OB----means then ----NH-----and ---Self---has to
    disable(vice versa).
    I have also achieved the same using the DA.
    With true action as: javascript Expression i have given the following codings( i have written the below DA for three cases, if the request_class_code is equal to
    (NH,OB,S)
    var enabled=$v('P22_REQUEST_CLASS_CODE');
    if (!$u_SubString(enabled,'S')) $('#P22_REQUEST_CLASS_CODE_2').attr("disabled","disabled");
    if (!$u_SubString(enabled,'NH')) $('#P22_REQUEST_CLASS_CODE_0').attr("disabled","disabled");
    if (!$u_SubString(enabled,'OB')) $('#P22_REQUEST_CLASS_CODE_1').attr("disabled","disabled"); The above DA is working great only for the user who has the option of viewing three radio buttons in my form(i.e)(NH,OB,S).
    For the user who has the option of viewing two or one radio button, it is not working properly(i.e)(NH,S) or(OB,S) or(S).
    Why it is not working for the user with two options or with one option radio button means, the source of that radio button property is changing. Since i have taken
    the source of my radio button in my DA only when the three options are present.
    How i can solve this issue for the user who is having this two radio option or one radio option.
    Hope you understood clearly about the problem.
    Brgds,
    Mini

    Hi,
    If I did understand what you like have this might work
    var lVal = $v('P22_REQUEST_CLASS_CODE');
    $('#P22_REQUEST_CLASS_CODE input:not([value="' + lVal + '"])').attr("disabled","disabled");Regards,
    Jari
    http://dbswh.webhop.net/dbswh/f?p=BLOG:HOME

  • Using Radio Buttons in queries.

    Dear Experts,
    I am working on some queries which has radio button option in R/3.
    I need to develop the same queries in BI 7.0.
    Do i need to develop separate queries for each radio button  or is there any other option to do ?
    Say for instance, i need to develop some queries based on different dates like
    Loading date, actual good movement date, ETA date like.For all the dates radio buttons are provided in R/3 reports.How to inculcate the same in BI 7.0.
    pls suggest .
    Thanks in advance.
    Regards
    GK D

    does it need to look identical or just have the same functionality?
    if its just the functionality you can just do it with one and make the selection variables optional...its probably a better idea to try and train the users on the BEx interface as it will benefit everyone in the long term

  • Dynamic Radio Buttons that offer dynamic output

    I am wondering if coldfusion has the abilty to perform the task
    I am looking for. I want to list radio buttons
    as options, and depending on which radio button the user selects,
    they are then offered a series of other radio buttons.
    Is this something coldfusion can handle, or would a different language
    be better suited for this?

    You are looking for a javascript solution.  CF or any backend can handle
    dealing with the data, sending back and forth data about what radio button
    list to show, etc easily.  But if you want no browser refreshes, then you
    need to look into javascript to display the list, use ajax to poll for
    refined radio button options, then display.  I recommend looking into jquery
    and CF.  CF can get the options from the database for you and serve to
    jquery which is run int he browser which will dictate how to display it
    nicely.
    http://api.jquery.com/radio-selector/
    <http://api.jquery.com/radio-selector/

  • Transaction iView radio button parameter

    Hello everyone!
    I have built a Transaction iView for the transaction CU50 and would like to know how I can set the value/parameter for the radio button for the first screen that pops up.
    This is a pop-up where I have to select the plant, which are radio button options. How and what parameter do I give in the Application Parameters in the properties of this Transaction iView?
    Regards,
    Sameer

    Hi Sameer,
    <i><<This is a pop-up where I have to select the plant, which are radio button options.</i>
    To select that particular plant,you need to know the screen_field name first.
    The field name for plant is <b>WERKS</b>
    (In the screen for cu50...keep the cursor on Plant input field and press F1 and in the help popup...choose technical information tab....which opens another popup where you will be able to see the field data for plant)
    In the transaction iview,here's how the ApplicationParameter works :
    You can enter parameter values for certain screen fields for displaying a SAP transaction here.
    The parameter values are specified with the following syntax:
    <Screen_field1>=<Parameter1>
    &<Screen_field2>=<Parameter2>
    &<...>=<...>,...
    Chek out the following <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/88/266a3e54a2e946e10000000a114084/frameset.htm">link</a> on Transaction iviews for more info.
    Its a good question you have put up.
    P.S:Reward points if useful
    Regards,
    Abhishek.

  • Why can't I see an export value option in my radio button properties? I am using Acrobat X pro.

    Why can't I see an export value option in my radio button properties? I am using Acrobat X pro.

    Thanks so much. Thought it was just the name of the button and did not realize it was the value. Now able to use them for calculations.

  • NO-DISPLAY option for Radio buttons

    Hi All,
    I want to hide the 2 radio buttons on the selection screen using the NO-DISPLAY option. when i worked with that its giving an error like 'no-display and radio button group can be specified together'.
    my question was is it possible to use NO-DISPLAY option with radio buttons?
    Thanks
    Kumar.

    See this sample code
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-h01.
    *Radio button for Process PO invoice
    PARAMETERS :   rb_po   RADIOBUTTON GROUP inv USER-COMMAND rad.
    " PO Invoice
    *Radio button for FI Invoice
    PARAMETERS :   rb_fi   RADIOBUTTON GROUP inv.
    " FI Invoice
    *Radio button for Process PO & FI Invoice
    PARAMETERS :     rb_pofi   RADIOBUTTON GROUP inv.
    " PO & FI Invoice
    SELECTION-SCREEN END OF BLOCK b3.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS:
                    s_bukrs   FOR  rbkp-bukrs,       "Company Code
                    s_ekorg   FOR  ekko-ekorg NO INTERVALS MODIF ID md2,
                                                 "Purchasing Org.
                s_ekgrp   FOR  ekko-ekgrp NO INTERVALS MODIF ID md2,
                                                     "Purchasing Group
                s_werks   FOR  rseg-werks NO INTERVALS MODIF ID md2,
                                           "Plant
                    s_lifnr   FOR  rbkp-lifnr NO INTERVALS,
                                                     "Vendor
                s_matkl   FOR  ekpo-matkl NO INTERVALS
                                              MODIF ID md1,
                                                     "Material Group
                s_belnr   FOR  rbkp-belnr NO INTERVALS,
                                                     "Invoice Number
                    s_ebeln   FOR  rseg-ebeln NO INTERVALS MODIF ID md2,
                                                     "Purchasing Document No
                    s_gjahr   FOR  rbkp-gjahr NO INTERVALS,
                                                    "Fiscal year
                s_budat   FOR  rbkp-budat NO INTERVALS,
                                                    "Posting date
                    s_blart   FOR  bkpf-blart NO INTERVALS,
                                                    " Document Type
                    s_bldat   FOR  bkpf-bldat NO INTERVALS,
                                                    " Invoice Date
                s_usnam   FOR  rbkp-usnam NO INTERVALS.
    "User
    *Report type
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    *Radio button for User Report
    PARAMETERS :     rb_user  RADIOBUTTON GROUP za DEFAULT 'X' <b>USER-COMMAND rad MODIF ID md2.</b>"User report
    SELECTION-SCREEN COMMENT 3(20) text-003 FOR FIELD rb_user MODIF ID md2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    *Radio button for Managing Report
    PARAMETERS :     rb_man   RADIOBUTTON GROUP za
                                          <b>MODIF ID md2.</b>
    "Management Report
    SELECTION-SCREEN COMMENT 3(20) text-004 FOR FIELD rb_man
                                            MODIF ID md2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END  OF BLOCK b2.
    SELECTION-SCREEN END  OF BLOCK b1.
    AT SELECTION-SCREEN OUTPUT.
    * Checking Radiobuttons and modifing Material Group field  .
      PERFORM f13000_check_radio.
    FORM f13000_check_radio.
    * When the FI button is selected hide the fields under group md1 and MD2
      LOOP AT SCREEN.
        IF screen-group1 = 'MD2'
        OR screen-group1 = 'MD1'.
          IF rb_fi  = c_x
          OR rb_pofi = c_x.
            screen-active = 0.
          ELSE.
            screen-active = 1.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    * If the user output radiobutton is checked then make the screen
    * input of Material Group off
    <b>  LOOP AT SCREEN.
        IF screen-group1 = 'MD1'.
          IF rb_user = 'X'.
            screen-active = 0.
          ELSE.
            screen-active = 1.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.</b>
      IF rb_user = 'X'.
    *   When display for material group is off
    *   then refresh the select option for material
    *   group
        REFRESH s_matkl.
      ENDIF.
    ENDFORM.      " f13000_check_radio
    hope this helps.

  • Radio button and select option in one line

    Hi,
    I have an requirement in which i need to display the radio button and select option in one line in an report program.
    How can i do it? 
    Regards,
    Arun.

    Hi,
    Try this code.
    TABLES: bkpf.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: p_r1 RADIOBUTTON GROUP a.
    SELECTION-SCREEN COMMENT 4(20) text-001 FOR FIELD p_r1.
    SELECTION-SCREEN COMMENT 30(12) text-002 FOR FIELD p_date.
    SELECTION-SCREEN POSITION 39.
    SELECT-OPTIONS: p_date FOR bkpf-budat OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS: p_r2 RADIOBUTTON GROUP a.
    text-001 = " Radio button"
    text-002 = "Posting date"

  • When i am on the 4 step in Search Result Display options, i get errors after 2 radio buttons

    I am using Oracle portal 9.0.2 version
    When i am on the 4 step in Search Result Display options, i get errors after 2 radio buttons
    Default Search Results Page
    This Search Portlet
    An unexpected error has occurred (WWS-32100)
    User-Defined Exception (WWS-11230)
    Unknown Exception (WWC-45131)
    ORA-20101:
    ORA-06512: at &quot;PORTAL.WWSBR_STDERR&quot;, line 437
    ORA-06512: at &quot;PORTAL.WWPOB_API_PAGE&quot;, line 3369
    ORA-01403: no data found
    ORA-01403: no data found (WWC-11230)
    No data found (WWS-32101)
    ORA-1403: ORA-01403: no data found
    ORA-01403: no data found (WWC-36000)
    Error: An unexpected error occurred: User-Defined Exception (WWC-43000)
    Please help me with this one
    P.S I tried to run inctxgrn.sql, but it did not solve the problem

    i solved the problem by runing 2 scripts as a portal user
    You can refer to bug - 2418089. This was fixed in 9.0.2.3
    begin
    wwpre_api_value.set_value_as_number
    p_path => 'oracle.portal.search',
    p_name => 'searchresultpageid',
    p_level_type => wwpre_api_value.SYSTEM_LEVEL_TYPE,
    p_level_name => null,
    p_value => 6,
    p_commit => true
    commit;
    end;
    begin
    wwpre_api_value.set_value_as_number
    p_path => 'oracle.portal.search',
    p_name => 'searchresultpagesiteid',
    p_level_type => wwpre_api_value.SYSTEM_LEVEL_TYPE,
    p_level_name => null,
    p_value => 6,
    p_commit => true
    commit;
    end;
    NOTE - The difference is the value of 'p_name' attribute. If u see carefully it is 'searchresultpagesiteid'. The first time u run this the value is 'searchresultpageid'.

  • Select options and radio button problem

    Hi All,
    In selection screen I have a select option and two radio button default is disable when I input value on select option, it will enable radio button. How can I do this?
    Thanks.
    mlai

    Please go through the below code and reward points if u find it useful:
    tables : pa0000.
    selection-screen begin of block b1 with frame title text-001.
    select-options : s_pernr for pa0000-pernr.
    parameters : r1 radiobutton group g1 modif id abc.
    parameters : r2 radiobutton group g1 modif id abc.
    selection-screen end of block b1.
    at selection-screen output.
    if s_pernr[] is initial.
    loop at screen.
    if screen-group1 = 'ABC'.
    screen-invisible = 1.
    modify screen.
    endif.
    endloop.
    else.
    loop at screen.
    if screen-group1 = 'ABC'.
    screen-invisible = 0.
    modify screen.
    endif.
    endloop.
    endif.
    Thanks
    Vasu

Maybe you are looking for

  • Video import from AE to PP blurry and bad quality video.

    Hi all, Im having a weird problem with AE cs6 and Premiere pro cs6. Whenever i import an AE to Premiere Pro, the quality becomes bad and blurry. When the project is rendered from AE to a video project (like QT) the quality is great. The videos I am w

  • Excise duty + flat rs.10000

    Hi I have one MM cin related query. The client wants for perticulat item the excise duty cond type JMO2 should be 16%+ Rs.10000. By using the AltCaBv routine 363 i am getting 16% exacly, which I have maintained in J1id in excise tax rate  but there i

  • Problems using 'IN' clause

    I'm making a procedure, and it has a cursor. This cursor receive some parameters and one of them is a list of numbers, the list can't be a VARCHAR2 with ',' or ';' as separator, because it doesn't work, if I use a defined type like 'vet IS TABLE OF N

  • FLV format & use?

    Hi, I was sent an FLV and when I double-clicked it, it launched my Flash Player 8, but the screen was blank. Nothing played. I'm only familiar with FLAs and SWFs so can you give me a quick overview about FLVs? Also, how large are typical movie files

  • Digit not working in WEP key entry mode

    My wep no. requires the digit 1 to sync with my phone . however the digit 1 will not on my phone in wep key enter mode . It also will not work in vertical mode while texting, but will work in horizontal mode while texting only. I have tried resetting