Get Map values using loops

Hi,
With a vector I can have a loop and to get the values with a index.
Vector vec = new Vector()
for(int idx=0; idx>vec.size(); idx++){
    System.out.println(vec.get(idx).toString());
}I can do something similar with a map ? in other words have a loop and get the map values.
I know that the map a other java.util Collections don't have a
public Object get(int index)
method as Vector, but How I can simulate this in a map.
Some idea ??
thanks

what about using an iterator?
Iterator it = map.values.iterator();
while (it.hasNext()) {
Object o = it.next();
hf,
dani

Similar Messages

  • 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.

  • 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

  • Get the values using substr

    Hi All,
    i am a comma seperated values into a variable. below are the values.
    "1234567,3,124567,3,14"
    the length of the values can vary. eg the output can also be
    "123,3,124567,443,1224"
    I need to get each value and store it a separate variable. is it possible using substr..?
    Please help me out...

    Hi,
    Here's how you can split a delimited list into parts in Oracle 9:
    WITH     got_part_cnt     AS
         SELECT     pk
         ,     csv
         ,     1 + LENGTH (csv)
                - LENGTH (REPLACE (csv, ','))     AS part_cnt
         FROM     table_x
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     ( SELECT  MAX (part_cnt)     AS max_part_cnt
                FROM       got_part_cnt
         CONNECT BY     LEVEL <= max_part_cnt
    ,     got_pos          AS
         SELECT     p.pk
         ,     p.csv
         ,     c.n
         ,     INSTR ( ',' || p.csv
                    , 1
                    , c.n
                    )          AS start_pos
         ,     INSTR ( p.csv || ','
                    , 1
                    , c.n
                    )      AS end_pos
         FROM    got_part_cnt     p
         JOIN     cntr          c     ON     c.n     <= p.part_cnt
    SELECT       pk
    ,       csv
    ,       n
    ,       SUBSTR ( csv
                 , start_pos
               , end_pos - start_pos
               )               AS item
    FROM       got_pos
    ORDER BY  pk
    ,            n
    ;Pk is the primary key of table_x. If you don't need it, you can omit it.
    Of course, this will work in versions later than 9, but you wouldn't want to if you could use REGEXP_SUBSTR.

  • 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.

  • Export/Import the mapping value used in Value Mapping Function

    I used value mapping function, so I defined some mapping data at Integration Directory. now I need migration from development xi to production xi, so How to export the data I input at development xi and later import it? or anyone could provide other solution for replacing value mapping function?
    Hope from your helps
    Thanks
    Spring
    Message was edited by: Spring Tang
    Message was edited by: Spring Tang
    Message was edited by: Spring Tang

    Hi Spring Tang,
      You can export your mapping object in .mte format.
      For this press ctrl+shift and right click in the
      mapping editor. Then go to tools and export the same.
      Similarly you can import the mapping object.
      Hope this will solve your problem.
      Thanks and Regards
      Vishal Kumar

  • 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 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.

  • Memory leak in "get property value (string)" ?

    Hi,
    I'm not sure which forum to post this to because it involves a combination of labview and teststand.  The error I'm getting is more teststand related so it is here.
    In our application, we have a labview queued state machine launched by a teststand step using "launch vi asynchronously".  In one of the states of this state machine, we are looping grabbing frames from a camera, querying a teststand using "get property value (string)", to overylay on the video on each frame.  This is so when we post process the video, we can tell what step(s) teststand was performing (we are writing a status string to a property from teststand as well).  Since this string has to be overlayed on the video for each frame to be visible when played back, this happens many many thousands of times over the multi hour test runs of the platform.  
    My problem is, after 22 hours or so of running, I get an error generated from the "get property value (string)", saying cannot create any more threads.  The only thing wired to this tool in our vi is sequence context, which is passed in when the vi is launched from teststand.  When opening the "get property value (string)" vi itself, it is very simple, consisting of a "aspropertyvalue" casting, reading of the string from the proprety, closing the aspropertyvalue reference, and exiting.  It does not seem like there should be any "threads" being created here, except for perhaps the vi itself executing. But in that case I would assume the OS itself would clean up after itself. 
    BTW, the OS I am testing on is win7 x64.  I did see this though running on our xp box once as well though, same amount of time.  It is very repeatable.  My next plan is to disable this get property value using a disable case, and run again, but I"m still wondering why this error is occurring.  Any help or insight will be appreciated.
    Thanks
    David Jenkinson
    Hi,I'm not sure which forum to post this to because it involves a combination of labview and teststand.  The error I'm getting is more teststand related so it is here.
    In our application, we have a labview queued state machine launched by a teststand step using "launch vi asynchronously".  In one of the states of this state machine, we are looping grabbing frames from a camera, querying a teststand using "get property value (string)", to overylay on the video on each frame.  This is so when we post process the video, we can tell what step(s) teststand was performing (we are writing a status string to a property from teststand as well).  Since this string has to be overlayed on the video for each frame to be visible when played back, this happens many many thousands of times over the multi hour test runs of the platform.  My problem is, after 22 hours or so of running, I get an error generated from the "get property value (string)", saying cannot create any more threads.  The only thing wired to this tool in our vi is sequence context, which is passed in when the vi is launched from teststand.  When opening the "get property value (string)" vi itself, it is very simple, consisting of a "aspropertyvalue" casting, reading of the string from the proprety, closing the aspropertyvalue reference, and exiting.  It does not seem like there should be any "threads" being created here, except for perhaps the vi itself executing.  There seems to be something going on behind the scenes of this get property value tool that isn't cleaning up after itself?
    BTW, the OS I am testing on is win7 x64.  I did see this though running on our xp box once as well though, same amount of time.  It is very repeatable.  My next plan is to disable this get property value using a disable case, and run again, but I"m still wondering why this error is occurring.  Any help or insight will be appreciated.
    Thanks
    David Jenkinson

    Hi David,
    Have you tried just using property node | Method Nodes instead of using the VI. There should be no difference but I think that VI is polymorphic ie the input with change depending on what's wired to it eg string, double etc.
    Regards
    Ray Farmer

  • How can we get the values from the view?

    Hi All,
    my scenario is i have two fields in my view .one is parameter.and another on is select-options.how can i get the user entered values into my selection screen.?
    for the select options i get the values into field-symbol.for parameter i get the value using get_attribute.
    can i use like this in select statement.
    WHERE SERVICE_ID  = ZSD_DD_AUFNRS
                       AND CRE_DT IN <FS_DATE>.
    Regards,
    Ravi.

    Hi Sravan,
    when i am using the below code to generate self defined functions i m getting a error .
    *Generate an object for self defined functions
      DATA: lo_self_functions TYPE REF TO if_salv_wd_function_settings,
    *Generate an object for button 'Confirm'
           lr_button TYPE REF TO cl_salv_wd_fe_button,
           lo_self_function TYPE REF TO cl_salv_wd_function,
                  l_text type string.
    *Set Self-defined functions
    *'Confirm' Button
      lo_self_functions ?= l_value..
      lo_self_function = lo_self_functions->create_function( 'CONFIRM'  ).
      CREATE OBJECT lr_button.
      CLEAR l_text.
      l_text = 'Confirm'.
      lr_button->set_text( l_text ).
      lr_button->set_image_source( '' ).
      lr_button->set_image_first( 'X' ).
      lo_self_function->set_editor( lr_button ).
    Error when processing your request
    What has happened?
    The URL http://cgslsvr3.cgsl.com:8020/sap/bc/webdynpro/sap/zsdr_cash_work_list/ was not called due to an error.
    Note
    The following error text was processed in the system CGD : WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set
    The error occurred on the application server cgslsvr3_CGD_20 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RAISE of program CX_WD_GENERAL=================CP
    Method: CONSTRUCTOR of program CL_WDR_VIEW_ELEMENT===========CP
    Method: CONSTRUCTOR of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: NEW_TOOLBAR_BUTTON of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEM of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system CGD in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server cgslsvr3_CGD_20 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server cgslsvr3_CGD_20 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 110 -u: CT-0024 -l: E -s: CGD -i: cgslsvr3_CGD_20 -w: 0 -d: 20080414 -t: 105835 -v: RABAX_STATE -e: UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    How can i resolve it?
    Regards,
    Ravi

  • Table or Function Module to get Condition Values of Quotation

    Hi MM Gurus
    I created RFQ. Then I maintained Quotation for few Vendors. In the Quotation, I used tax code relevant to taxes in India (TAXINN procedure). I am asked to develop a Z report with the help of ABAPer to compare the quotations with Gross price, discounts, freight along with taxes like Excise Duty, VAT etc. When I had put this Quotation number in EKKO table, I am not getting the condition document number KNUMV. For other purchasing documents, this field is getting generated. Without this field, I can not get Condition values using KONV table as we need to link EKKO-KNUMV with KONV-KNUMV. Do you have any idea how we get the condition values of taxes for Quotation? Is there any function module to get it?
    I really appreciate the quick answer.
    Thanks
    Ravi

    Hi
    Try ME_GET_PRICE_CONDITION
    Regards
    Antony

  • Get domain value range dynamically

    Hi all,
    I need to create a dynamic method that retrieves the value range (key-value) of a domain.
    It is pretty simple to get fixed values using FM DD_DOMVALUES_GET, but how do I manage a value table?
    For example:
    Field XFELD has fixed values so use DD_DOMVALUES_GET
    Fields BUKRS and SPRAS have value tables.
    I can get the value table name using FM DDIF_FIELDINFO_GET and retrieve the data from that table. Unfortunately, I can be sure to get the right key field, but I can't be sure to get the right value field, it depends on the value table definition.
    BUKRS has T001 that stores the text in field BUTXT of the same instead SPRAS has T002 that stores the text in text table T002T in field SPTXT.
    Is there any standard function module that does the trick?
    In this thread Gregor Wolf managed it manually using a case statement, but I would avoid it, too many case statements...
    Thanks
    Ivan

    What I am doing is not quite the same but similar - I am dynamically getting the text description when I have a data element and the value of the variable that references that data element.
    I was pointed to CL_TEXT_IDENTIFIER which when you pass in the domain and the value magicaly brings back the text description, despite the fact that, as far as I can see, SAP has set up almost every text table slightly differently - sometimes in the main table like T001W or lFA1, sometimes which just the language and the value as a key, sometimes with extra key fields (e.g. MAKT) and sometimes with added organisational key fields e.g. the same GL account have different text descriptions in different chart of accounts.
    I think at some stage CASE statements or subclasses are going to have to come into the equation, due to the utter lack of consistency in SAP table defintions.
    Cheersy Cheers
    Paul

  • Get Query value Technical Name

    Hi,
    I have ZANALYSIS template and different queries use this template, I have to show a link to download a document. The document will be stored as Query Techincal Name.DOC.
    So i need to get QUERY techincal name in runtime to build path, how can i get the query techincal name....using javascript.
    <object>
    <param name="OWNER" value="SAP_BW"/>
    <param name="CMD" value="GET_ITEM"/>
    <param name="NAME" value="THIS VALUE WILL BE FROM Bex iview"/>
    function buildUrl(){
    var url = "http:testbox:50000/irj/km......"document.getElementById("QUERY").innerHTML".DOC";
    alert(val);
    basically my document path is .."http:testbox:50000/irj/km......"<QUERY TECHNICAL NAME>".DOC"
    Iam not gettng the QUERY techincal name..can anyone please help to solve this issue...
    iam using NW04's...
    Thanks,
    Damodhar.

    Hi,
    I have to get the query value using java script.....
                <bi:QUERY_VIEW_DATA_PROVIDER name="DP_1" >
                    <bi:INITIAL_STATE type="CHOICE" value="QUERY" >
                        <bi:QUERY value="<b> i need to get this value using java script</b>" />
                    </bi:INITIAL_STATE>
                </bi:QUERY_VIEW_DATA_PROVIDER>
    any suggestions ..please..
    Thanks,
    Damodhar.

  • How do you create a user defined functions  UDF and passing a value like a ID to GEt a Value.

    How do you create a user defined functions UDF and passing a
    value like a ID to GEt a Value.
    using a query.
    are there example.
    Thanks

    tons of examples at cflib.org - good place to start, even
    though many
    udfs there are a bit outdated in their code...
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Getting Node Value of an XML element in JAVA.

    Hi,
    In my application, I have got the exact node that I want by parsing the document, but the node value returned is null as the node is an element and the Java Documentation does specify that it will return null. I would like to know if there in any alternative way by which I can parse the document and get the specified value of the node or element. Kindly help.

    Hi,
    i am using the dom parser. My code is as follows.
    Document xmlDocument, outputDoc;
                   DocumentBuilderFactory dbfObject = DocumentBuilderFactory.newInstance();
                   DocumentBuilder dbObject = dbfObject.newDocumentBuilder();
                   xmlDocument =  dbObject.parse("IPD_Response.xml");
                   Element dd = xmlDocument.getDocumentElement();
                   NodeList ItemAttributes = dd.getElementsByTagName("Element Name");
                   System.out.println("element" + ItemAttributes.item(0));
                   Node ss = ItemAttributes.item(0);
                   NodeList bb = ss.getChildNodes();
                   Node cc = ss.getFirstChild();
                   System.out.println("element sibling1 "+bb.item(0));
                   System.out.println("element sibling 2"+bb.item(1));
                   System.out.println("element sibling 3"+bb.item(2));
                   System.out.println("element child "+cc);
                   Node aa = bb.item(0);
                   NodeList qqq = aa.getChildNodes();
                   System.out.println("element sibling1---1 "+qqq.item(0));
                   System.out.println("element sibling1---1 "+qqq.item(1));
                   Node fff = qqq.item(0);
                   Node aaa = qqq.item(1);
                   String value1 = fff.getNodeValue();
                   String value2 = aaa.getNodeValue();
                   System.out.println("1st value "+value1+" 2nd value "+value2);What my code does is gets all the elements within a particular tag. After that i look for the child nodes, which i have done successfully. But when i get the value using getNodeValue(); method it will be null as per the Java Docs. Is there any other way by which i can get the node value. Kindly help.
    How do you parse the XML Document ?
    Are you using a DOM Document ?
    Which parser do you use ?
    How do you access the Element ?
    Post the releveant part of the code and using the
    [code ]  tags as described in[url=http://forum.java.sun.com/help.jspa?sec=formattin
    g]Formatting tips
    andi

Maybe you are looking for