How to get multiple values using HttpSession.getAttribute(java.lang.String)

Hey Guys
I'm trying to find a way to get multiple values using the following method
HttpSession.getAttribute(java.lang.String)
Here's the scenerio. Its a already written application and now i'm trying to make some changes. earlier in the jsp page a combo box was used and value was retrieved in the servlet using the getAttribute method of Session. Now I'm using a html multiple selection list and have to retrieve all the values selected in the list in the servlet. Can anyone please suggest me how to do that. HTTPRequest class has a method getParameterValues which will let me do that but i have to do is using HTTPSession.
Thanks for your time to read this

I'm not sure what you are trying to do. You can only use session.getAttribute to retrieve something that has already been stored in the session with a previous setAttribute. If you need to store multiple values under one attribute name using setAttribute, you can store an array, or an ArrayList or whatever type of Collection you want. The request.getParameterValues method is the only way you can retrieve form parameters than can have multiple values. If the servlet hasn't already processed these parameters and put them into the session for you, you have to use request.getParameterValues.

Similar Messages

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

  • How to get multiple values from the list

    I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
    <%     // clicked on Select District Button
    Vector vselectedDistrict = new Vector();
    Vector vdistrictID = new Vector();
    String tmpSelectDistrict = "";
    tmpSelectDistrict = request.getParameter("bSelectDistrict");
    if(tmpSelectDistrict != null)
         // get multiple values from the list
         String[] selectedDistrict = request.getParameterValues("usrTDistrict");
         vselectedDistrict.clear();
         vdistrictID.clear();
         if((selectedDistrict != null) && (selectedDistrict.length != 0))
                             for(int i=0;i<selectedDistrict.length;i++)
                   vselectedDistrict.addElement(selectedDistrict);           
              vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
              for(int i=0;i<vdistrictID.size();i++)
                   out.println("district = " + selectedDistrict[i]);                         out.println("district ID= " + vdistrictID.get(i).toString());
    %>
    // get vdistrict from the database here......
    <select name="usrTDistrict" size="5" multiple>
    <%     for(int i = 0; i< vdistrict.size(); i++)
    %>
         <option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
    <%
    %>          
    </select>
    <input type="submit" name="bSelectDistrict" value="Select District">
    Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
    what I got is this error message:
    org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    So where is going wrong and what the message means?. Any help very much appreciated. Thanks

    These are just guesses that might hopefully steer you in directions you haven't looked in yet.
    I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
    Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
    expects a Vector as its second parameter? And returns a Vector?
    I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector?

  • How to get Multiple Values for a key from a session object?

    Hi,
    It might seem dumb but I am facing a problem here with the session object. I'll paste the session object's content from the netbeans "Local Variables" window for clarity -
    Name Type Value
    hsession StandardSessionFacade #66
    session LWSFSession #69
    inherited
    attributes Hashtable #80
    [0] Hashtable$Entry "cart"=>#115
    key String "cart"
    value DummyCart #115
    item null
    submit null
    v Vector
    [0] String Full Metal Jacket
    [1] String As Good As It Gets
    [2] String Tim
    What I want is to get the values "Full Metal Jacket", "As Good As It Gets" and "Tim" from the session obejct?
    The problem I am facing is that if I do a session.getAttribute("cart"), I'll get a single value in return. What will that value be? Will it be "item", "submit" or "v"? And if I want all the values in v above, how can I get them?
    Thanks.

    None of the above.
    HttpSession.getAttribute() will return what you put into it using HttpSession.setAttribute(). In your case, it'll return an Object which you need to cast to DummyCart. Then you can access the data in DummyCart using the API of the DummyCart class.
    hth

  • How to get int value from [session.getAttribute("String")]

    i am not able to get int value from the following statiment
    int i=session.getAttribute("String");
    i also try by casting it into int but it dont work, can somebody help me in this regard

    abuu wrote:
    i am not able to get int value from the following statiment
    int i=session.getAttribute("String");
    i also try by casting it into int but it dont work, can somebody help me in this regard
    Integer i=(Integer)session.getAttribute("String");
    i.intValue();but know how it is working. that is useful.
    Diablo.

  • How to get selected values (using checkBox) from DataGrid in flex.

    i have a datagrid which is getting values from a XML file (getting this xml file from database using PHP and HTTP request in flex). i have created a checkbox in every row in data grid. and here is my requirement: i want to select tow or three check-box and would like to get all the values form that particular ROWs in some form , prefered arraycollection (such that i can pass this array directly to a bar chart) .. can some one help me as i am new to flex .
    code ......
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="siteData.send()">
              <mx:Script>
                        <![CDATA[
                                  import mx.collections.XMLListCollection;
                                  import mx.controls.*;
                                  import mx.events.ListEvent;
                                  import mx.rpc.events.ResultEvent;
                                  import mx.controls.Alert;
                                  [Bindable] private var fullXML:XMLList;
                                  private function contentHandler(evt:ResultEvent):void{
                                            fullXML = evt.result.values;
                        ]]>
              </mx:Script>
              <mx:VBox>
                        <mx:Label text="This Data Grid is loading the full XML file"/>
                        <mx:DataGrid width="600"  id="datagrid" dataProvider="{fullXML}">
                                  <mx:columns>
                                            <mx:DataGridColumn headerText="Select">
                                                      <mx:itemRenderer>
                                                                <mx:Component>
                                                                          <mx:HBox horizontalAlign="center">
                                                                                    <mx:CheckBox id="check"/>
                                                                          </mx:HBox>
                                                                </mx:Component>
                                                      </mx:itemRenderer>
                                            </mx:DataGridColumn>
                                            <mx:DataGridColumn dataField="release_version" headerText="Release"/>
                                            <mx:DataGridColumn dataField="build" headerText="build"/>
                                            <mx:DataGridColumn dataField="time_login" headerText="time_login"/>
                                            <mx:DataGridColumn dataField="time_tunnel" headerText="time_tunnel"/>
                                            <mx:DataGridColumn dataField="rate_login" headerText="time_tunnel"/>
                                            <mx:DataGridColumn dataField="rate_tunnel" headerText="rate_tunnel"/>
                                  </mx:columns>
                        </mx:DataGrid>
              </mx:VBox>
              <mx:HTTPService url="http://localhost/php_genxml.php" id="siteData" result="contentHandler(event)" resultFormat="e4x"/>
    </mx:Application>
    as you can see in the image , i will get this datgrid . now i want to select two or three checkboxes and would like to get all the values form the perticular row (for which check box is selected). i would like to get in array from such that i can driectly pass them to bar chart....
    can some one help me in this. as i m new to flex. or if you have some other suggestion ...My final requirement is: select some values and generate bar gharph for those values.
    please help me in this.
    thanks
    tanuj

    Hi Timo -
    Thanks for the suggestion. I could get the values as below:
    public void multiOpUnitValChange(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding opUnitIter = (DCIteratorBinding)bindings.get("OperatingUnit2VOIterator");
    Integer[] values = (Integer[])valueChangeEvent.getNewValue();
    for (int i=0; i<values.length; i++){
    Row row = opUnitIter.getRowAtRangeIndex(i);
    System.out.println(row.getAttribute("OpUnitId"));
    Thanks -
    Rohit

  • How to get XML value using servlet?

    how to get values from a XML file using servlet ? Thank you.
    for example: how can I get the location value (aaa) from this XML file?
    abc.xml:
    <business>
    <location>aaa</location>
    </business>

    Try to use XML Parsers to do the job.
    Use DOM or SAX Parsers that are freely available.
    Some of the popular ones are xerces, DOM, SAX.

  • How to return multiples values useing functions

    Hi to all,
    I am using functions to return multiple values of two rows or multiple rows.
    For example emp id = 100 and i need to return the value for this(empid) input and output of this first_name and salary.
    I am tried in this way below but got errors (ORA-00932: inconsistent datatypes: expected NUMBER got HR.EMP_TYPE)
    create or replace type emp_type as object(first_name varchar2(20),salary number);
    create or replace function f1(empid in number)
    return emp_type
    as
    emp_record emp_type;
    begin
    select first_name,salary into emp_record.first_name,emp_record.salary from employees where employee_id = empid ;
    return emp_record;
    end;
    select f1(100) from dual;

    Sql is Sql and plsql is plsql. Though we can almost use all the sql objects inside a plsql code but vice versa is not always possible. Since plsql is tightly integrated with sql , if you return a number/date/varchar2 datatype values from plsql code to sql code,there is nothing wrong .Sql acknowledges this return type and knows well about how to handle it .But plsql record is a plsql specific datatype ,oracle was not built keeping in mind the fact that people will be creating difference types of records in plsql .So if you return a plsql datatype into a sql statement (which is processed by a sql engine) ,you need to tell oracle that I have written a plsql code which is going to return a record type so that sql engine can interpret it well.
    So all you need to do is create record in sql (known as object in sql ),when you make one, the entry is going to be shown in user_types views. Now use it like any other data type. I assume that the forum link provided in the above post is the best one to understand.
    Thanks,
    Rahul

  • How to get year value using regular expression

    Hi,
    I have a different format of date such as 2004-01-03, 2003/01, 05/06/2005, 06-05-2007
    How can I get only the year value using regular expression? The year value is always in 4 digits
    Thanks in advance

    sabre150 wrote:
    JosAH wrote:
    \d{4}Is this the Jos I knew who poured scorn on anything to do with regex? Is this the Jos I knew who said that the 'pimping lemon' stopped regex being of any real use?It wasn't me; honest, I'm innocent: one of my parrots walked over my keyboard; I wouldn't be able to type such nonsense; naughty parrot! No cookie!
    kind regards,
    Jos
    ps. regexes can only survive the baby-pumping-lemma; they all die a horrible death with the real-men-pumping lemma! So there.

  • How to get multiple value on html chart with apex

    Hi All,
    I'm looking for a way to compare 2 value on a html chart with apex (ex. Budget with expense).
    Some one know how I could make a chart with 2 value ( a kind of histogram with the bar Budget and expenses side to side with only one title)
    Thanks all !
    Edited by: 844999 on 2011-04-05 07:59

    sims wrote:
    Hi Anil,
    Its a standard page & i want it on click of apply button but my question is when i click apply button it navigates to other page..is it possible in such scenario to extend the controller.
    Thnx for ur suggestion
    SimsThat is not an issue, you can extend the controller of that page and get the value of sequence and set it to the VO attribute.
    Thanks
    --Anil
    http://oracleanil.blogspot.com

  • How to get multiple values in a variable and apply filter at run time

    Hi experts,
    I want to get the deprtment information for an user. User may belongs to many department.
    when user login at run time the filter should be apply for his departments.
    users deprtments chnages frequently so we can't hardcode it.

    Hi,
    Please refer to below post for one of the causes of this error:
    Re: obiee-ebs  data  security integration
    Also, can you check if you are getting NULL values for any rows. This might be the issue too. To verify this add ' and a.BUSINESS_UNIT_CODE is not null' in your query and check the results. Ensure you restart the BI services, clear your cache and then verify your result.
    Thanks

  • How to get multiple values from the db using select

    hi all,
    i am using oracle 9i database
    i created a procedure
    create or replace procedure sample_proce
    as
    to_i varchar2(50)
    begin
    select to_id into to_i from sample where flag in('y');
    dbms_output.put_line('hai'|| to_i);
    end;
    when i executed this procedure the following error occurred.
    error at line 5 fetching too many rows.
    but when i execute the select query alone i can able to view all the rows.
    how to resolve it

    i used the following procedure
    create or replace procedure sample_proc
    as
    begin
    for s in(select to_id from sample where flag='y')
    loop
    dbms_output.put_line(s.to_id);
    end loop.
    end;
    it is executed fine. i can able to fetch all the rows.
    how to pass all these values into the another procedure.
    we usually pass only one value into another procedure, i do no how to pass all the values . please help me.
    Thank u.

  • How to get default value using VA

    using jdev 11.1.1.6.2
    I defined a transient attribute with a default expresssion as
    oracle.jbo.Row r = getPayeeNameVA().first();
    if(r != null)
    return r.getAttribute("PartyName");
    I have a VO named PayeeVO with a vc haiving one bind variable. This VO is used to create PayeeNameVA view accessor. In PayeeNameVA the default VC is shuttled and value is bound to one of the view attribute.
    However, on running the app I get below exception. please advise
    aused by: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException, msg=Cannot cast object 'oracle.jbo.script.ExprEvalWrapper@3b50bd53' with class 'oracle.jbo.script.ExprEvalWrapper' to class 'oracle.jbo.Row'
         at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1411)
         at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1457)
         at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1435)
         at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1217)
         at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2262)
         at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1884)
         at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1940)
         at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:883)
         at oracle.apps.afg.creditRules.model.view.CreditReceiversVORowImpl.getPayeeName(CreditReceiversVORowImpl.java:780)
         at oracle.apps.afg.creditRules.model.view.CreditReceiversVORowImpl$AttributesEnum$2.get(CreditReceiversVORowImpl.java:39)
         at oracle.apps.afg.creditRules.model.view.CreditReceiversVORowImpl.getAttrInvokeAccessor(CreditReceiversVORowImpl.java:830)
         at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:913)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1137)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:731)

    Hi,
    apparently you access the wrong object, which is ExprEvalWrapper, and this cannot be cast to the Row object you really want to work with. I assume that Row is wrapped by this class. However, the ExprEvalWrapper is for internal framework use and the super class, which is org.codehaus.groovy.runtime.wrappers.PojoWrapper, exposes the getWrappeed method as a protected method. Without knowing your exact use case I think you will need to find another solution (e.g. expose a method on the entity impl class you then call from Groovy)
    Frank

  • How to get Multiple Values for a single Variable in BPS.......

    Hi Gurus:
    I have a layout for planning, where I can plan for 5 days of the week. I also have a day column (yesterday) where I have the actual values. Users want to edit/foecast the next 5 days values. I am using a Variable to get the Date column which uses the System Date. However, since I am getting just one date in the Function Module (Code given below), the remaining days are greyed out and I can not enter the forecast values. I would like the same variable to get a series of dates in the same function module. What changes do I nee dto make in the ABAP code so that the remaining columns (Date) becaoe available for editing??
    The FM code I have to get "Today's Date" is as follows:
    FUNCTION ZCSHFL_GET_TODAY.
    ""Local Interface:
    *" IMPORTING
    *" REFERENCE(I_AREA) TYPE UPC_VAR-AREA
    *" REFERENCE(I_VARIABLE) TYPE UPC_Y_VARIABLE
    *" REFERENCE(I_CHANM) TYPE UPC_Y_CHANM
    *" REFERENCE(ITO_CHANM) TYPE UPC_YTO_CHA
    *" EXPORTING
    *" REFERENCE(ETO_CHARSEL) TYPE UPC_YTO_CHARSEL
    data: ls_charsel type upc_ys_charsel.
    ls_charsel-seqno = 1.
    ls_charsel-sign = 'I'.
    ls_charsel-opt = 'EQ'.
    ls_charsel-CHANM = I_chanm.
    ls_charsel-low = sy-datum.
    insert ls_Charsel into table eto_charsel.
    ENDFUNCTION.
    I want to get the Yestarday's Date as weel as dates for next 4 days from Today for this variable which are being used in the layout. Can anyone suggest the code tor this please.
    Thanks very much in advance......
    Best.... ShruMaa

    Hi,
    What I understand you need to return those dates from function module using parameter ETO_CHARSEL , right? If so just use this code:
    ls_charsel-seqno = 1.
    ls_charsel-sign = 'I'.
    ls_charsel-opt = 'BT'.  "we are giving ranges, so days between...
    ls_charsel-CHANM = I_chanm.
    ls_charsel-low = sy-datum - 1.  "...first day is yesterday
    ls_charsel-high = sy-datum + 4. "...and last day is 4 days from today
    insert ls_Charsel into table eto_charsel.
    This way you provide 5 days starting from yesterday till 4 days from today.
    Regards
    Marcin

  • Multiple Values using if-- inlist

    Hi,
    How to pass multiple values  using inlist and if
    =if([Plant] InList("2010";"2012";"2014";"2016";"2018") ; xyz") ElseIf([Plant] InList("2020";"2022";"2024";"2026";"2028"); "pqr") ElseIf
    ([Plant] InList("2030";"2032";"2034");"abc") else ([dgh])
    i am getting error in this please correct it
    Thanks & Regards,
    Vinay

    Use  "Then " to resolve above error.
    For example :
    =If([Year]InList("2001";"2002";"2003")) Then "Y" ElseIf ([Year]InList("2005";"2006";"2007")) Then "yy" Else ([Year])
    Regards,
    Pranay

Maybe you are looking for

  • Placing More Than One Photo On A Page

    Can you add in the scrapbook format more than one photo per page? I have a friend who wants me to create a DVD for him with over 500 photos, and the only way I can cheat it is by placing two photos together in Photoshop, then putting the large JPG in

  • How to update Billing Plan using BAPI_SALESORDER_CHANGE

    Hi, In my case initailly sales order header data is created and saved, with reference to SO Project is created and then item level data is updated. So clients requirement is to create any upload programme which can use for mass upload. i.e to develop

  • Regarding-Purchase requisition

    Dear All, While creating the purchase requisition user is changing the delivery address. So I need to block the changing options to user. Once we enter the plant name delivery address will extract from the data. Kindly suggest me how can I block the

  • Selecting "open in new tab" from right click menu does nothing

    I just updated to firefox 24 on OXS. The right click menu now makes no sense. When I right click on a web link, then select "open in new tab" nothing happens. No tab opens. On the other hand, I now see countless irrelevant options for that link, like

  • Bookmarking a login form in OAM

    In OAM, if a user attempts to access a secured resource, OAM redirects to a unsecured login page. Life is good. If a user directly navigates to the login form, however, OAM is unaware of the navigation (no obsso cookie) and the subsequent post to the