How to test if an option of select is selected?

Hello,
I have a main page (main.jsp) which calls the servlet (MusicAlbum.do) which in turn accesses the database to get the selected kind of music sent by the user.
<%-- main.jsp --%>
<form action="MusicAlbum.do" method="get" >
          <select name="genre" onchange="submit();">
                      <option selected="selected" >(Please select a kind of music)</option>
                      <option>Jazz</option>
                      <option>Classical</option>
                      <option>Country</option>
                      <option>Blues</option>
          </select>
</form>If the selected kind of music contains no items, i.e the listTitles forwarded by the servlet to the main.jsp is null, how do you test in the main page to abtain this message : "Sorry, there are no items in this album." which is displayed below the options?
I've done like this but it doesn't work:
<c:choose>
       <c:when test="${submitted && empty listTitles}">
             <c:out value="Sorry, there are no items in this album!"/>
            <a href="main.jsp">Please choose another genre</a>
       </c:when>
       <c:otherwise>
       </c:otherwise>
</c:choose>Thanks a lot for your help.

I've found the problem with the help of my teacher.
In fact, my way of using the album names (Jazz, Classical, etc) for the options was not correct. I have hard-coded them :
<form action="MusicAlbum.do" method="get" >
          <select name="genre" onchange="submit();">
                      <option selected="selected" >(Please select a kind of music)</option>
                      <option>Jazz</option>
                      <option>Classical</option>
                      <option>Country</option>
                      <option>Blues</option>
          </select>
</form>The right way is to retrieve them from the database via a servlet.
Once this is done, when I click on an item which contains no album titles at all, the message "There are no items in this album" will be displayed.

Similar Messages

  • How to access the Document Options dialog box to select display properties?

    How to access the Document Options dialog box to select display properties (e.g. smartcut ) for a selected document to
    be viewed in the Workspace.
    regards

    Preferences --> General --> Reset all warnings.
    Mylenium

  • How can I get all options under edit in iPhoto to appear and revert in red, the only option it gives me is to select multiple

    how can I get all options under edit in iPhoto on my phone to appear it has revert in red on theleft side & done on the right side, the only choice it gives me is select multiple

    The usual cause of that issue is a corrupted or missing font that Firefox replaces by another, in this case a bold, font.
    As a test you can try to disable the default font and choose a few different fonts (Arial, Verdana, Tahoma, Times New Roman) to see if you can identify the culprit.<br />
    you will have to reinstall that corrupted font.

  • How to get all values in the range of select option into internal table?

    Hi,
    I need to capture all entries coming in the range of select option into one internal table.
    How to do get that?
    For E.g
    select-options: matnr for mara-matnr.(select option)
    IF I enter G0100013507892 as lower value of matnr and G0100014873947 as higher value
    and if there are 10,000 materials in the above range, then I want to capture all theses 10000 materails in one internal table. How to do that?
    Regards,
    Mrunal

    Hello Mrunal Mhaskar  ,
    What i understand you can do one thing  go in debug mode
    Try this code : -
    LOOP AT s_matnr_ex.
      IF s_matnr_ex-low IS NOT INITIAL.
        i_matnr-matnr = s_matnr_ex-low.
        i_matnr-option = s_matnr_ex-option.
        APPEND i_matnr.
        CLEAR : i_matnr.
      ENDIF.
    ENDLOOP.
    LOOP AT s_matnr_ex.
      IF s_matnr_ex-high IS NOT INITIAL.
        i_matnr-matnr = s_matnr_ex-high.
        i_matnr-option = s_matnr_ex-option.
        APPEND i_matnr.
        CLEAR : i_matnr.
      ENDIF.
    ENDLOOP.
    In the i_matnr table high and low values are there.
    Regards,
    Vandana.

  • How to restrict more than one 1 range in select option on selection screen.

    Hi all,
    I have a requirement where I need to restrict user from giving more than 1 range for a date selct option ..other all features of multiple selection will be as usual...
    for eg we can do this if we disable / hide other cells if the user clicks on multiple ranges tab.. If only 1 cell is available to give the range user will not be able to give more than 1 range....
    I was thinking if I could use select_options_restrict but how do i fill its parameters...
    Can anyone send me the sample code or the same to achieve this functionality...I have used select_options_restrict to hide multiple ranges itself  ... But here user will be able to give range but only 1....
    Thanks and Regards
    Sweta

    HI,
    Please try the below logic.
    SELECT-OPTIONS: so_addr   FOR    ADR6-SMTP_ADDR NO INTERVALS.
    ***********remove_range_for_select_option******************* .
      DATA: ls_restrict  TYPE  SSCR_RESTRICT,    "The type for SELECT_OPTIONS_RESTRICT
            ls_opt_list  TYPE  SSCR_OPT_LIST,    "One list of options
            ls_asn       TYPE  SSCR_***.         "One line of table associating selection screen
                                                                      "object with opt. list
      CLEAR: ls_restrict,
             ls_opt_list,
             ls_asn.
    *Only EQ valid, discrete values, Include & Exclude
      ls_opt_list-name       = 'EQ'.
      ls_opt_list-options-eq = 'X'.
      APPEND ls_opt_list TO ls_RESTRICT-OPT_LIST_TAB.
      LS_ASN-KIND            = 'S'.
      LS_ASN-NAME            = 'SO_ADDR'.            "Select Option
      LS_ASN-SG_MAIN         = 'I'.
      LS_ASN-SG_ADDY         = '*'.
      LS_ASN-OP_MAIN         = 'EQ'.
      LS_ASN-OP_ADDY         = ' '.
      APPEND LS_ASN TO LS_RESTRICT-***_TAB.
    *Make use of SELECT-OPTIONS easier on the selection screen
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
        EXPORTING
          RESTRICTION            = LS_RESTRICT
        EXCEPTIONS
          TOO_LATE               = 1
          REPEATED               = 2
          SELOPT_WITHOUT_OPTIONS = 3
          SELOPT_WITHOUT_SIGNS   = 4
          INVALID_SIGN           = 5
          EMPTY_OPTION_LIST      = 6
          INVALID_KIND           = 7
          REPEATED_KIND_A        = 8
          OTHERS                 = 9.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Edited by: Rajasekhar Reddy P on Mar 16, 2009 2:03 PM

  • How can I get the option to make an iPod selection playlist when there is not enough space on my iPod for my whole iTunes library?

    I am trying to sync my iPod with my iTunes library and I recently added more music to my library than there is space on my iPod. Normally, I know iTunes is supposed to give you the option of creating an iPod selection playlist, so you can choose which songs you want to put from your library onto your iPod. However, iTunes won't currently give me that option. It simply gives me an error message saying there is not enough free space to sync my iPod. How can I get it to create the iPod selection playlist?

    Start deleting stuff from your iPod to make room. 

  • In Preview the option for mailing the selected pdf document in missing.  How do I get it back?

    In Preview the option for mailing the selected pdf document in missing.  How do I get it back?

    From the Mail menu bar, select
    Mail ▹ Preferences ▹ General ▹ Default email reader: Mail

  • How to see the dropdown option for field of a table during selection

    Hello,
    I am adding a new custom field in the table. Now when user goes to the screen after clicking the content button icon in se11, he sees all fields for selection.
    That custom field is one character field. I want the user to see P and S option when he hits F4 (Dropdown).
    How can I achieve this ?
    Regards,
    Rajesh.

    hi check this..
    report .
    TYPE-POOLS : vrm.
    TABLES:vbak,vbap.
    DATA : v(80) TYPE c.
    DATA: wa_vbak TYPE vbak,
          it_vbak TYPE vbak OCCURS 0 WITH HEADER LINE,
          wa_vbap TYPE vbap,
          it_vbap TYPE vbap OCCURS 0 WITH HEADER LINE.
      DATA: l_name TYPE vrm_id,
            li_list TYPE vrm_values ,
            v_count  TYPE i,
            l_value LIKE LINE OF li_list.
    PARAMETERS: p_test(20) AS LISTBOX VISIBLE LENGTH 60 MODIF ID DAT.
    INITIALIZATION.
    AT SELECTION-SCREEN OUTPUT.
      PERFORM get_data.
      LOOP AT it_vbak.
        l_value-key =  it_vbak-vbeln .
        l_value-text = it_vbak-vbeln .
        APPEND l_value TO li_list.
      ENDLOOP.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = 'P_TEST'
          values          = li_list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    AT SELECTION-SCREEN ON P_TEST.
      clear : li_list , li_list[].
      SELECT vbeln
             matnr
             meins
             FROM vbap
             INTO CORRESPONDING FIELDS OF TABLE it_vbap
             WHERE vbeln = p_test.
    START-OF-SELECTION.
      SELECT vbeln
             matnr
             meins
             FROM vbap
             INTO CORRESPONDING FIELDS OF TABLE it_vbap
             WHERE vbeln = p_test.
      LOOP AT it_vbap.
        WRITE :/ it_vbap-vbeln, it_vbap-matnr,it_vbap-meins.
      ENDLOOP.
    *&      Form  get_Data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
      SELECT  vbeln
              FROM vbak
              INTO  CORRESPONDING FIELDS OF TABLE it_vbak.
    ENDFORM.                    " get_Data
    regards,
    venkat

  • How to test the select statement.

    Hi All,
    How to test the select statement.
    Is there any Oracle sqlplus  or toad kind of tool to  test the query.
    thanks
    siva

    Use SQL Trace (ST05) and choose 'Explain one SQL Request'. Enter your SQL command as it should be executed in the underlying database. e.g. if the db is Oracle, the statement should be entered as:
    SELECT matnr,werks,lvorm,dispo
    FROM marc
    WHERE mandt = :a AND
                 matnr = :b AND
                 werks = :c
    In the above :a, :b and :c are place holders for the actual comparison values. You dont have to enter those values. When you choose 'Explain' button, you will find the 'Execution Plan'. The important parameter which denotes the efficiency of the SQL statement is the 'Cost'. The cost should be as low as possible. The table access should be through INDEX UNIQUE SCAN. If you get a FULL TABLE SCAN and higher cost, you need to fine-tune your statement by modifying the where clause.
    If you dont know Oracle SQL statements, execute the program in trace mode and go to the trace and you will find the underlying SQL statements issued to the database.
    Regards
    Suresh Radhakrishnan

  • How to prevent the use of wild cards in select-option

    Hello experts,
    Is it possible to prevent the use of wild cards in a select-option? If yes, how is it done please?
    I have a
    SELECT-OPTIONS: o_comp  FOR dbtab-field OBLIGATORY DEFAULT 'FI'.
    and, I want to prevent the users for giving in some thing like FI* with the wildcard bc it would lead to dump.
    I want an error message to display and prevent the users for making such entry.
    Please I need your help and I would be very grateful.
    Thanks
    Nadin

    You have to use SELECT_OPTIONS_RESTRICT to restrict input allowed. Call this FM in INITIALIZATION or SELECTION-SCREEN OUPUT sections.
    Sample :
    TYPE-POOLS: sscr.
    INITIALIZATION.
    * Restrict SELECT-OPTIONS
      PERFORM restrict_select.
    FORM restrict_select.
      DATA: restrict TYPE sscr_restrict,
            opt_list TYPE sscr_opt_list,
            *** TYPE sscr_***.
    * Défine select-options modes (aka option list)
    * - ALL standard - all options allowed
      CLEAR opt_list.
      MOVE 'ALL' TO opt_list-name.
      MOVE 'X' TO: opt_list-options-bt,
                   opt_list-options-cp,
                   opt_list-options-eq,
                   opt_list-options-ge,
                   opt_list-options-gt,
                   opt_list-options-le,
                   opt_list-options-lt,
                   opt_list-options-nb,
                   opt_list-options-ne,
                   opt_list-options-np.
      APPEND opt_list TO restrict-opt_list_tab.
    * - EQU only equality allowed (list of values)
      CLEAR opt_list.
      MOVE 'EQU' TO opt_list-name.
      MOVE 'X' TO opt_list-options-eq.
      APPEND opt_list TO restrict-opt_list_tab.
    * Affect modes to parameters or block of parameters
    * ALL by default
      CLEAR ***.
      MOVE: 'A'          TO ***-kind,
            '*'          TO ***-sg_main,
            'ALL'        TO ***-op_main.
      APPEND *** TO restrict-***_tab.
    * EQU to internal material number
      CLEAR ***.
      MOVE: 'S'          TO ***-kind,
            'S-MATNR'    TO ***-name,
            'I'          TO ***-sg_main, " no exclusion
            'EQU'        TO ***-op_main. " only value list
      APPEND *** TO restrict-***_tab.
    * Call  FM
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
           EXPORTING
                restriction = restrict
           EXCEPTIONS
                OTHERS      = 1.
    ENDFORM.                    " restrict_select
    In the sample, only select-options for matnr is restricted to single value list.
    For your request build a mode with all options except "pattern" ones : CP and NP.
    Regards

  • How to create Option Boxes IN A SELECTION SCREEN

    How to create Option Boxes IN A SELECTION SCREEN.
    Thanks!

    Hi Rajesh,
    The following explanation gives clear picture of what is mean of check box and radio button with coding.....................
    <b>CHECK BOX :</b>
    AS CHECKBOX [USER-COMMAND fcode]
    Effect:
    This addition specifies that the input field in the first position of the selection screen is displayed as a checkbox, with the corresponding description next to it on the right. The checkbox is selected if the value of para is "X" or r "x". Otherwise, it is not selected.
    The parameter must be created with the type c and length 1. An explicit length len is not permitted. If the addition TYPE is used, this can only be followed by the generic type c or a non-generic data type of type c and length 1.
    The addition USER-COMMAND can be used to assign a function code fcode to the parameter. The function code fcode must be directly specified and may have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects the checkbox on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.
    Notes
    If the TYPE addition is used to make a reference to a data type in the ABAP Dictionary of type CHAR and length 1, and for which t the valid values in the domain are defined as "X" and " ", the parameter is automatically displayed as a checkbox on the selection screen.
    If the addition USER-COMMAND is specified without the addition AS CHECKBOX, and the parameter is of type c with length 1, it is also displayed as a checkbox.
    The addition USER-COMMAND can, for example, be used for screen modifications with the addition MODIF ID (see example).
    <b>Coding :</b>
    PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p1(10) TYPE c,
                p2(10) TYPE c,
                p3(10) TYPE c.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
    PARAMETERS: p4(10) TYPE c MODIF ID bl2,
                p5(10) TYPE c MODIF ID bl2,
                p6(10) TYPE c MODIF ID bl2.
    SELECTION-SCREEN END OF BLOCK b2.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF show_all <> 'X' AND
           screen-group1 = 'BL2'.
           screen-active = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    <b>RADIO BUTTON COMMAND :</b>
    RADIOBUTTON GROUP group [USER-COMMAND fcode]
    Effect:
    This addition specifies that the input field is displayed as a radio button in the first position on the selection screen, and the output field is displayed next to it on the right. The radio button is selected if the value of para is "X" or "x". Otherwise, it is not selected.
    group is used to define the radio button group for the parameter. The name group is entered directly as a character string with a maximum of 4 characters. Within a selection screen, there must be a minimum of two parameters in the same radio button group. There cannot be more than one radio button group with the same name in one program, even if they are defined in different selection screens.
    The parameter must be specified with the type c and length 1. Explicit length specification using len is not permitted. If the addition TYPE is used, it can only be followed by the generic type c or a non-generic data type of type c and length 1.
    In a radio button group, only one parameter can be defined with the addition DEFAULT, and the specified value must be "X". By default, the first parameter in a radio button group is set to the value "X", and the rest are set to " ".
    The addition USER-COMMAND can be used to assign a function code fcode to the first parameter in a radio button group. The function code fcode must be specified directly, and have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects any radio button of the radio button group on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.
    Note:
    It is recommended to define the radio buttons of a radio button group directly underneath each other. If the selection screen also contains other elements, it is recommended to define each radio button group within a block surrounded by a frame.
    <b>CODING :</b>
    tables : mkpf,mseg,ekko.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1,
                c as checkbox.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X' USER-COMMAND UC1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    write :/ p_werks,
           / s_ebeln.
    AT SELECTION-SCREEN OUTPUT .
    LOOP AT SCREEN .
    IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
    SCREEN-INPUT = 0.
    SCREEN-REQUIRED = 1.
    clear s_ebeln[].
    clear p_werks.
    MODIFY SCREEN.
    ENDIF.
    IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
    SCREEN-INPUT = 0.
    SCREEN-REQUIRED = 1.
    clear s_ebeln[].
    clear p_werks.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    Let me knwo if any doubts.
    <b>Reward with points if it helpful</b>
    Regards,
    Vijay

  • How can I print from my MacBook Pro to Canon MP560 using rear tray?  I can't find that "option" in the print selection possibilities.

    How can I print from my MacBook Pro to Canon MP560 using rear tray?  I can't find that "option" in the print selection possibilities.

    Sure can.
    With a document open in Pages, select to print so that you can see the print dialog as shown below.
    Note that to see this view, you may need to press the Show Details button in the bottom left corner. In the image above, since I have the expanded view displayed, this button changes to Hide Details
    So with the view shown, first change the Presets menu to Default Settings. Then click the Layout drop menu and select Quality & Media. Make the changes you want and then click on the Presets menu and select Save Current Settings as Preset...
    At the next window, give the Preset a name and select the Only this Printer radio button and then click OK to save it. That's it.
    As for the Preset that you already have, if you no longer want this preset then you can delete it via the Show Presets menu pane that you've used already.

  • HT202631 How do you create a appleid but i cant select the none option and i don't have anything to pay with.

    How do you create a appleid but i cant select the none option and i don't have anything to pay with.

    Hello, did you mean create an Apple ID without any credit card info?
    If that I can help. Just go to iTunes and choose a "Free" apps to download. After that, it will pop up with "sign in with existing Apple ID" or "Create a New Apple ID". Click create a new apple id. through this process, you will see a "none" choice in payment method while registering the Apple ID.

  • How to use Abap Editor(SE38) Test Plan Management Option

    Hi,
    I am trying to use the Test Plan Management option in Abap Editor.
    I could not find any articles/forum postings about it.
    Please guide me on the same.

    hi,,
    go through the below link for help.
    http://help.sap.com/saphelp_erp2005vp/helpdata/EN/06/27185efc5211d1bcfd080009b4534c/frameset.htm
    regards,
    bhavana

  • How to validate a select-option field on the selection- screen

    Hi,
       I need to validate a selection-option field in the selection-screen.
    Requirement is : i need to read each of customer number one by one and validateCan you please me in achieving this.
    Best Regards
    Mamatha.B

    hi,
    chk this sample code.
    SELECT-OPTIONS : s_kunnr for kna1-kunnr.
    AT SELECTION-SCREEN.
         if 'S_KUNNR-HIGH' = "condition
        "put your required validation here
         endif.
    rgds
    Anver
    Message was edited by:
            Anversha s

Maybe you are looking for

  • HDMI audio not working in HP Pavilion dv4 1290-br

    Hello, people. I can't get my HDMI audio to work on my laptop (HP Pavilion dv4 1290-br). The output of aplay -l is: **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: STAC92xx Analog [STAC92xx Analog] Subdevices: 1/1 Sub

  • How to load files up one step from local working directory

    Good afternoon, I have a project assigned to me that has some Ni TestStand code written to read files from a fixed directory and I would like to change this directory to be the directory where the TestStand seqeunce file is located. Furthermore, I wo

  • Identifying emac with refurbished serial #

    Hi all, I bought a used emac from a craigslister in here in seattle. I tried to look up its specs by serial # but it's refurbished or remanufactured and I cannot find a reference site for it. The number is: xxxxN9L Edited by an Apple Discussions Host

  • PO flow

    Hi,   Can you please let me know the solution for the following flow:    1) We have service PO with five items distrubuted over different cost centres.  We tried to distribute among cost centres using multiple account assignment in the PO. During GR,

  • Can my computer be saved?

    I've got a Vista here that I purchased about three years ago. I've been having some troubles with it, and a couple of months ago it completely died. I tried using the system recovery discs, but no luck. I just bought a new harddrive, as I was told th