How to select value from list with multiple selections ?

HI,
i have a list with multiple selections where i show email address retrieved from database.
what i want to do is to send the selected email address to the invoiceedit.jsp.
please look at the following code which gives you the better idea.
<td class='smalltext'><select name="email" size="3" multiple="multiple">
   <% 
   Connection conn = null;
   Statement stmt = null;
   Statement stmt_contactperson = null;
   Statement stmt_address = null;
   try{
      conn = getREConnection();
       stmt = conn.createStatement();
   ResultSet rs = null;
   rs = stmt.executeQuery("SELECT PROPERTYID, VALUE FROM PROPERTIES WHERE ENTITYID="+ g_strGroupID+" AND NAME = 'invoice_default_email'");
   int numofrows = 0;
   while(rs.next())
           %>
   <option value="<%= rs.getString("VALUE") %>" selected="selected"> <%= rs.getString("VALUE")  %> </option>
    <%
       }//end of while
      %>
     </select>
    <a href="invoiceedit.jsp?entityid=<%=g_strGroupID%>&add=1"><font color="#000000">Add</font></a>
     <a href="invoiceedit.jsp?entityid=<%=g_strGroupID%>&email_to="><font color="#000000"> Edit</font></a> </td>thanks

Use a form button instead of a link so that you can send it as a request parameter to the server. In the server side just use HttpServletRequest#getParameterValues() to obtain all values for the given parameter name. If you really need a link rather than a button, then use Javascript to submit the form on click of the link.
That said, your design is bad. Java code belongs in Java classes, not in JSP files. Database access logic belongs in a DAO class. Business and controlling logic belongs in a Servlet class. Only presentation logic belongs in the JSP file. Avoid scriptlets as much as possible and use JSP EL and/or JSTL instead.

Similar Messages

  • [svn:fx-trunk] 10943: Fix to dragging from List with multiple-selection

    Revision: 10943
    Author:   [email protected]
    Date:     2009-10-08 15:46:27 -0700 (Thu, 08 Oct 2009)
    Log Message:
    Fix to dragging from List with multiple-selection
    - The fix is to postpone the selection commit until we make sure the user has not started a drag gesture.
    - Exclude the dragEnabled, dropEnabled, dragMoveEnabled properties for DropDownList
    QE notes: None
    Doc notes: None
    Bugs: None
    Reviewer: Deepa
    Tests run: checkintests, mustella List, DropDownList
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as

  • How to get value from list item

    Hi all,
    How to get value from list item?
    I have a problem with the List Item object
    in the Oracle forms.
    How can I retrieve the selected item from
    a list ?
    I didn't find any function like 'list.GET_
    SELECTED_ITEM()'...
    thanks
    Bala

    Hello,
    You get the value as for any other Forms item:
    :value := :block.list_tem ;Francois

  • Create Word Doc from list with multiple items (repeat region)

    I have a document library that creates an invoice document based on another list. The list has multiple items that where purchased and need to appear on the invoice. It is only showing the first purchase item and not the others. How do I get all the items
    to display (repeating region)?
    Example:
    Invoice #
    Salesperson
    Items Purchased
    item 1
    item 2
    etc...
    Thanks!

    I've tried these examples but it only grabs the first item and places it in the word document. I need it to grab all the items.
    Example:
    Invoice #
    Salesperson
    Items Purchased
    item 1
    item 2
    etc...

  • How to get value from list of string

    Hi All,
    I have list of values (11,16,18) I need to get 16 i.e mid value . This string can go long .. How Will I do this . Is ther any function in Oracle 10g which supports this .
    Any assistance will help
    Thanks in advance .
    Sachin

    Or...
    SQL> ed
    Wrote file afiedt.buf
      1  With T
      2   AS
      3   (SELECT '11,16,18,50,60,70' str FROM DUAL UNION ALL
      4    SELECT '11,16,18,50,60,70,90,40,30' str FROM DUAL UNION ALL
      5    SELECT '11,16,18' str FROM DUAL
      6    )
      7  --
      8  select regexp_substr(str, '[^,]+', 1, lvl)
      9  from t, (select level lvl from dual connect by rownum <= (select max(length(regexp_replace(str,'[^,]')))+1 from t))
    10  where regexp_substr(str, '[^,]+', 1, lvl) is not null
    11* order by t.str, lvl
    SQL> /
    REGEXP_SUBSTR(STR,'[^,]+',
    11
    16
    18
    11
    16
    18
    50
    60
    70
    11
    16
    18
    50
    60
    70
    90
    40
    30
    18 rows selected.
    SQL>(assumes there are no empty values in the strings)

  • Query multiple values from tables with multiple conditions

    I'm trying to display the addresses from an employee record. There are two tables: employees and emp_addresses. There can be any number of addresses which is defined by the address type.
    What I want to do is get all the employees and all of the addresses for that employee in the same result.
    Addresses table:
    emp_id
    address1
    address2
    address3
    city
    state
    zip
    type (either H for 'home' or W for 'work')
    I would like the result set to be:
    emp_id | home_address1 | home_city | work_address1 | work_city
    Do I have to use a join? I'm not sure how to go about it.

    Hi,
    user9179751 wrote:
    I'm trying to display the addresses from an employee record. There are two tables: employees and emp_addresses. There can be any number of addresses which is defined by the address typeIf there can be any number of addresses, and you want to show all of them, then you probably need String Aggregation . See this page for different ways to do it:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    A related topic, that usually works better with a known number of columns, is Pivoting . See these links:
    SQL and PL/SQL FAQ
    There are ways to make pivoting work with a variable number of columns. See this thread:
    Re: Report count and sum from many rows into many columns
    What exactly are your requirements? Do you rally need separate columns for each address, or is it okay to have one big VARCHAR2 column that's formatted so it looks like separate columns? If you really need separate columns, do you know an upper limit to how many (e.g., there will never be more than 5)?
    What I want to do is get all the employees and all of the addresses for that employee in the same result.
    Addresses table:
    emp_id
    address1
    address2
    address3
    city
    state
    zip
    type (either H for 'home' or W for 'work')
    I would like the result set to be:
    emp_id | home_address1 | home_city | work_address1 | work_cityWhenever yo have a question, post CREATE TABLE and INSERT statements for some sample data, and the exact results you want from that data. Showing the column names for the sample data isn;t nearly as helpful as shoiwing some actual data (with column names). Showing the header line that goes over the results isn't nearly as helpful as showing the actual results (with the header line).
    Always say which version of Oracle you're using. Sting aggreagation and pivoting techiniques have changed significantly in every version since Oracle 7.
    Do I have to use a join? I'm not sure how to go about it.Using a join, you could get one more address for every join, but since there could be any number of addresses, you'd need any number of joins, and that means dynamic SQL. Join probably isn't the best approach in this case.

  • Creating Select List with multiple columns

    I want to create a select list with multiple columns. I followed the demo application model described in the by Denes Kubicek (Currently my reference for APEX !!)
    The code is as follows:
    CREATE OR REPLACE FUNCTION getcrops(p_cropid IN NUMBER)
    RETURN VARCHAR2
    IS
    v_cropid VARCHAR2 (400);
    v_fcode VARCHAR2 (400);
    v_product VARCHAR2 (400);
    v_var VARCHAR2 (400);
    v_fname VARCHAR2 (400);
    v_acres VARCHAR2 (400);
    v_style_start VARCHAR2 (400);
    v_style_end VARCHAR2 (400);
    v_return VARCHAR2 (400);
    BEGIN
    FOR c IN (select "CROP"."CROPID" as "CROP ID",
         "CROP"."FIELDCODE" as "FIELD CODE",
         "CARROTPRODUCTLIST"."CARROTPRODUCTNAME" as "PRODUCT",
         "VARIETYLIST"."VARIETYNAME" as "VARIETY",
         "FIELD"."FIELDNAME" as "FIELD NAME",
         "CROP"."SIZEINACRES" as "ACRES"
    from     "FIELD" "FIELD",
         "CARROTPRODUCTLIST" "CARROTPRODUCTLIST",
         "VARIETYLIST" "VARIETYLIST",
         "CROP" "CROP"
    where "CROP"."CARROTPRODUCTTYPE"="CARROTPRODUCTLIST"."CARROTPRODUCTID"
    and     "CROP"."VARIETYID"="VARIETYLIST"."VARIETYLISTID"
    and     "CROP"."FIELDID"="FIELD"."FIELDID")
    LOOP
    v_cropid := TO_CHAR (c.'CROP ID', 'FML999G999G999G999G990');
    v_fcode := c.'FIELD CODE';
    v_product := c.'PRODUCT';
    v_var := c.'VARIETY';
    v_fname :=c.'FIELD NAME';
    v_acres :=c.'ACRES';
    FOR i IN 1 .. 12 - LENGTH (c."CROP ID")
    LOOP
    v_cropid := v_cropid || ' ';
    END LOOP;
    FOR i IN 1 .. 12 - LENGTH (c.'FIELD CODE')
    LOOP
    v_fcode := v_fcode || ' ';
    END LOOP;
    FOR i IN 1 .. 12 - LENGTH (c.'PRODUCT')
    LOOP
    v_product := v_product || ' ';
    END LOOP;
    FOR i IN 1 .. 12 - LENGTH (c.'VARIETY')
    LOOP
    v_var := v_var || ' ';
    END LOOP;
    FOR i IN 1 .. 12 - LENGTH (c.'FIELD NAME')
    LOOP
    v_fname := v_fname || ' ';
    END LOOP;
    FOR i IN 1 .. 12 - LENGTH (c.'ACRES')
    LOOP
    v_acres := v_acres || ' ';
    END LOOP;
    v_return := v_cropid || v_fcode || v_product || v_var || v_fname || v_acres;
    END LOOP;
    RETURN v_return;
    END;
    I created this anonymous Pl/SQL function at a application level ..Then I followed up to create a select list with a function inside. However I could not create select list with the command suggested in the demo which is
    select getcrops(cropid) d, cropid r from crop;
    APEX (2.1) returns a error message. What am I missing ? Should the function be called from somewhere else after creating a regular select list..? Where the functions (Pl/SQL) should be ideally stored for application level access..? and for across application level access ? How can I check the function works good. Help is appreciated.

    Still really one column.
    If they need to be independent then you've got to have three selection lists.
    %

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • Selection list with multiple columns

    How can i create a selection list with multiple columns?

    Still really one column.
    If they need to be independent then you've got to have three selection lists.
    %

  • Save the selected value from listbox with its respective tab control dropdown selcted values in another listbox

    Hi all,
    I am making a vi where I have to save the selected value from listbox with its respective tab control dropdown selcted values in another listbox.Whenever I select Item1 then the heading change and respective tab will open for that item.But Now I just want to save the selection and put it in another ListBox.SO that I can renmove or add according to my wish. Plz help me.
    Solved!
    Go to Solution.
    Attachments:
    my_vi.png ‏83 KB

    Hi, I successfully make the vi to insert itmes from listbox1 to listbox2.Whenever I select itmes 1 in listbox 1 it display same elected item in listbox2 , but it not appending the items in listbox2.Like If 1 is selected in listbox1 then 1 will display , next time after saving when I selct next item like 3 then in listbox 2, 1 is replaced by 3,it dont come in second row of listbox2.Hope I am able to explain.\
    Plz help me to resolve this.
    Attachments:
    listbox_update.vi ‏11 KB

  • How do i take one layer with multiple selections...

    how do i take one layer with multiple selections and make those selections their own layer?

    Yes sir. It w was really hard to explain. It is discontiguous segments that are separated by transparent areas. And I want those non transparent areas to be on their own layer. I have a photo shop file that has a bunch of buttons on them and they are on a transparent background. It is one layer. I want to select all the buttons and put them on their own layers. I can do this manually by selecting a button and cmd Just to a new layer, but when I have 200 buttons it is a daunting task.
    Sent by MailWise<http://www.mail-wise.com/installation/4> – Your emails, with style.

  • Select list with multiple columns

    I want to create a select list with multiple column option. What are the options. Any developments in apex 3.0.1 ? Thanks in advance. I tried the tutorials by Kubicek.
    I am kind of stuck to see the function entry inside LOV definition returns a error.

    Still really one column.
    If they need to be independent then you've got to have three selection lists.
    %

  • List with multiple selection

    Hello;
    I seek a code to implement a list with multiple selection for a browser Web (HTML is imited).
    I have a list containing of the years, the user can select one or several years and I created dynamically a array : for each year a column.
    Thank you;

    Look at JList.
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JList.html
    � {�                                                                                                                                                                           

  • How to export All computer list with operating system from AD and all attributes like disable or enable and OU location also?

    how to export All computer list with operating system from AD and all attributes like disable or enable and OU location also?
    I have tried with dsquery below but status is not showing there.
    dsquery * -filter "(objectCategory=computer)" -attr name operatingSystem

    last logon user name - not really stored (or lined) with computer object.  However, you can get this info during the logon process or from the computer.  Here is method:
    http://portal.sivarajan.com/2010/07/user-profile-and-os-info-powershell.html
    Santhosh Sivarajan | Houston, TX | www.sivarajan.com
    ITIL,MCITP,MCTS,MCSE (W2K3/W2K/NT4),MCSA(W2K3/W2K/MSG),Network+,CCNA
    Windows Server 2012 Book - Migrating from 2008 to Windows Server 2012
    Blogs: Blogs
    Twitter: Twitter
    LinkedIn: LinkedIn
    Facebook: Facebook
    Microsoft Virtual Academy:
    Microsoft Virtual Academy
    This posting is provided AS IS with no warranties, and confers no rights.

  • Add Option of choosing values from list in "Person Responsible" field of Cost Center Master

    Dear All,
    Could anyone advise me how can I add the option to Choose Values from list to field "Person Responsible",
    in Cost Center Master Data ?
    The Technical Name of this field is VERAK, and currently it is an open field.
    I would like to allow the user to choose values from existing list.
    Thank you!
    Orly

    Hi Orly,
    You have take it to your ABAPer, who will have to modify the attributes of CSKSZ-VERAK field in CSKSZ structure. ABAPer will have to define it with foreign key and introduce the name of the table, which will be used for deriving the available values. No standard table exists for it, but you can either create your own Z-table or take it from users table (USR02) if you have the necessary information there. Of course, this action would account for modification of standard SAP structure.
    Regards,
    Eli

Maybe you are looking for

  • TOMTOM through car stereo

    Hi All, I have trauled forums and still dont have an answer. Here is my query. I have an iPhone 4s all is fine, just installed the tomtom app, again great app however I want the nav instructions to speal thorugh my car stereo. (VW GOLF Mk6) now my is

  • Display result Group wise

    Hello experts, Update type is key in report. It has two values. 1000 & 2000. I want to display result after displaying all the values of 1000. same for 2000 values. Ex: 1000    ICICI     100            HDFC   200            SBI      300 Result       

  • Book format lost

    My wife has successfully created and printed a book using Aperature 2.1 - love it! Now a few months later she wants to modify and reprint the book. But when she opens the project, there is just all the photos used, displayed in the browser/viewer vie

  • Reference Fireworks files by link?

    In InDesign, there is a way to reference a file (create a link to another file). When you update the original file, the referencing file, when opened, asks the user 'would you like to update the link?'; is this action possible in Fireworks? This is w

  • Can't update from version 2.0.0.9 and downloads newest version. Can't get on MZ webpage

    OS XP, using Internet explorer, Can't get on MZFF site to get to Help to check updates then download newest version of MZFF I am a novice at computers and since I had to uninstall Yahoo, my daughter told me to get Mozilla Firefox for a browser.