Accessing element in a nested arraylist

Hi,
I have a LinkedHashMap that contains ArrayLists. Something like this:
{color:#3366ff}
ArrayList list = new ArrayList();
ArrayList list2 = new ArrayList();
LinkedHashMap<Integer, ArrayList> map = new LinkedHashMap<Integer, ArrayList>();
list.add(0, "list1 row1");
list.add(1, "list1 row2");
list.add(2, "list1 row3");
list2.add(0, "list2 row1");
list2.add(1, "list2 row2");
list2.add(2, "list2 row3");
map.put(0, list);
map.put(1, list2);{color}
How can I iterate over the elements in the arrays in the map in a JSP page?
Do I need to use the nested tag? Can anyone show me an example of how to print out e.g. "list1 row1"?
Thanks.

If you're using JSP 2.0, you can interate over nested lists using nested <c:forEach ....> tags.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page import="java.util.*" %>
<% // ugly scriptlet code that belongs somewhere else.
   // used here for demonstration purposes only.
  List rows = new ArrayList();
  request.setAttribute("rows", rows);
  for(int i = 1; i <=12; i++){
    List cols = new ArrayList();
    for(int j = 1; j <=12; j++){
      cols.add(String.valueOf(i * j));
    rows.add(cols);
%>
<html>
  <head>
    <title>nested forEach tags</title>
  </head>
  <body>
    <table border="1">
      <c:forEach var="row" items="${rows}">
        <tr>
          <c:forEach var="col" items="${row}">
            <td>${col}</td>
          </c:forEach>
        </tr>
      </c:forEach>
    </table>
  </body>
</html>Edited by: ben_souther on Sep 13, 2007 2:57 PM

Similar Messages

  • How can I access the sub elements of the Nested Cluster-2

    would like to know the label a sub element of a Nested Cluster. I have included the vi. I am trying to programmetically read the Text label of the data elements in Value N mode cluster (Max , Min Mode). I was looking into the Type descriptor document. It can tell me how many and what type of elements are in the cluster. But it does not gove me Refnum to those objects.
    Let me know if you have an solution to my question."
    Attachments:
    cluster_1.vi ‏24 KB

    Hi
    You need to do a recursion. If the reference you get from the array "controls[]" if of type cluster, then you have to loop through recursively.
    Openg toolkit has variant tools that might be of some help to you (www.openg.org).
    Good luck
    PJM
    Got EasyXML?
    JKI.VIPM.EasyXML.OpenG.LAVA.Builder.blog

  • How can I access the sub elements of the Nested Cluster

    I would like to know the label a sub element of a Nested Cluster. I have included the vi. I am trying to programmetically read the Text label of the data elements in Value N mode cluster (Max , Min Mode). I was looking into the Type descriptor document. It can tell me how many and what type of elements are in the cluster. But it does not gove me Refnum to those objects.
    Let me know if you have an solution to my question.
    Attachments:
    cluster_1.vi ‏24 KB

    I suggest posting this question on the LabVIEW forum. This is the Measurement Studio for Visual Basic forum and there are not nearly as many LabVIEW experts that monitor this forum as the LabVIEW forum.
    - Elton

  • Elements order in Nested Tables

    In PL/SQL when I am adding element to a nested table of objects one by one(in order), and then trying to insert that nested table type to a physical table , the order of element changes. how can I prevent this behavior?

    Your example is incomplete and has errors. Oracle does not guarantee the order of anything unless you use an order by clause. So, if you expect the following to produce rows in some order:
    Open cur1 for select * from another_table;
    then you need to add an order by clause, such as:
    Open cur1 for select * from another_table order by id;
    The following does minimal correction, completion, and provides sample data to demonstrate:
    SCOTT@orcl_11gR2> create or replace TYPE coord AS OBJECT
      2    (id  number,
      3       x   number,
      4       y   number);
      5  /
    Type created.
    SCOTT@orcl_11gR2> create or replace TYPE coord_tab AS TABLE OF coord;
      2  /
    Type created.
    SCOTT@orcl_11gR2> create table demo_table
      2    (id     number,
      3       coords     coord_tab)
      4  NESTED TABLE coords STORE AS coords_tabb
      5  /
    Table created.
    SCOTT@orcl_11gR2> create table another_table
      2    (id  number,
      3       x   number,
      4       y   number)
      5  /
    Table created.
    SCOTT@orcl_11gR2> insert into another_table values (10, 20, 30)
      2  /
    1 row created.
    SCOTT@orcl_11gR2> insert into another_table values (60, 50, 40)
      2  /
    1 row created.
    SCOTT@orcl_11gR2> DECLARE
      2    type cur is ref cursor;
      3    cur1 cur;
      4    type rec_type is record
      5        (id  number,
      6         x   number,
      7         y   number);
      8    record_type rec_type;
      9    coords_tab coord_tab := coord_tab();
    10    idx number := 1;
    11  BEGIN
    12    Open cur1 for select * from another_table order by id desc;
    13    LOOP
    14        fetch cur1 into record_type;
    15        exit when cur1%notfound;
    16        coords_tab.extend() ;
    17        coords_tab(idx) := coord(record_type.id, record_type.x , record_type.y);
    18        idx := idx + 1;
    19    End LOOP;
    20  --  EXECUTE IMMEDIATE 'insert into demo_table values (1,:1)' USING coords_tab ;
    21    insert into demo_table values (1,coords_tab);
    22  End;
    23  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> select * from demo_table
      2  /
            ID
    COORDS(ID, X, Y)
             1
    COORD_TAB(COORD(60, 50, 40), COORD(10, 20, 30))
    1 row selected.
    SCOTT@orcl_11gR2>

  • Access elements inside a dialog box/window using applescripts

    Am new to applescript. I want to access elements inside a dialog box/window. I tried following code.
    tell application "System Events" set procs to processes set windowName to {} repeat with proc in procs try if exists (window 1 of proc) then repeat with w in windows of proc if w's name contains "App Name" then copy w's name to the end of windowName copy properties of w to the end of windowName end if end repeat end if end try -- ignore errors end repeat end tell return windowName
    But am only able to get the 4 elements from window: 1.Close 2.Minimize 3.Maximize 4.window title
    Nothing from inside the window/dilog.
    Can any one help me with this pls?

    Hi,
    Like this :
    tell application "System Events"
          tell process "App Name"
                tell (first window) to if exists then return UI elements
          end tell
    end tell

  • I am unable to access Elements Inspiration Browser in Elements 10 Editor

    Does anyone know why I can't login (using my Adobe Id) when trying to access Elements Inspiration Browser from the Editor?

    Photoshop.com and the IB are dead and gone, have been for well over a year. There is nothing to log in to anymore.

  • How can I from one panel access elements on another panel ?

    I have a JFrame with 2 panels and a JMenu
    I am struggling to find a way how I can access JMenu from one of my panels ...
    Also how can I access elements on one panel from other panel ? At the moment I am passing a reference from one panel to other in the constructor but it's only one way communication now ... I can't go from second panel to first ...
    I am sure there must be an elegant way to solve this problem.
    Many thanks.
    Sergei

    OK I'll give you more details...
    I have a JFrame with multiple panels...
    Also I have a JMenu on JFrame...
    Now when user clicks a button on one of the panels I need to disable a menu item ... this is issue#1
    issue#2 is:
    how do I get two panels (they are separate classes) talking to each other ??? At the moment when I initialize a panel#2 from my Frame I pass to it reference to panel#1 and in this way panel#2 can talk to panel#1 but panel#1 can't talk to panel#2 ...
    I know there must be an elegant way to solve this problem... and I don't like having 2 classes tightly coupled like this... Can I use some kind of nice OO trick for this ? I was reading about custom listeners but I don't want to go crazy on this as I don't have time... actualy I've got only 1 day to solve this issue so any help will be greatly appreciated.
    Many thanks
    Sergei

  • ERROR: XML parse error: Error on line 1 of document: cvc-elt.1: Can not find the declaration of element 'model'. Nested exception: Can not find the declaration of element 'model'.

    I have install flash builder 4 beta 2 + blazeds 4.00.7548. While try to connect to data service and face a problem.
    When i use a beta 1 that no such probem. please help.
    ERROR: XML parse error: Error on line 1 of document: cvc-elt.1: Can not find the declaration of element ‘model’. Nested exception: Can not find the declaration of element ‘model’.

    Hello All!
    I'm just getting started with Flash Builder 4 and BlazeDS and I'm having this same issue.     I have installed the FlashBuilder 4 beta 2  Build 253292, and Blaze 4  ( blazeds-turnkey-4.0.0.14341 ).       I have also installed the livecycle_dataservices3_modelerplugin_100509.      Upon clicking Data-Connect to data/service and then Blazeds,   I can see my DAO object listed.   However, if I select it I receive the dreaded error.       Now if I code in the remote object manually, in the  .mxml file and run it, all works just fine.        It's only while trying to use the object within Flashbuilder that I have the problem.     I see lots of ideas kicked around for this, and it seems that various solutions have worked for different users.    Can somebody put together a 'cookbook' of just exactly how to set things up to make this work? 
    Thanks

  • Is it possible to access elements of a view in implementation class?

    Hi,
            In the BSP component workbench, is it possible to manipulate elements of a view (listbox, inputfields etc., hardcoded using htmlb tags) in the methods of view implementation class. For example, I have a inputfield which is initially invisible. I want to make it visible when a particular event is triggered. I wish to code this directly in the event handler method. Can anybody provide some pointers?

    Arun,
    As the UI elements (tags) do only exist during rendering phase a direct access from the view controller is not possible - especially not in the forward-oriented way from within an event handler as  indicated from you in the posting.
    However, it is of course possible to hard-code view layouts; for this approach you can use the BSP view corresponding to the view and code there whatever you like. BSP views can also contain code snippets to achieve dynamic effects. In your example it doesn't look like that you need code at all - you need to preserve the status (visible/ invisible) in a value attribute of a context node and use this value to bind visibility of the input field on the layout.
    In CRM 2007, there are two main tag libraries (aka BSP extensions) being used:
    - THTMLB (single tags, like input field, button, table, ...)
    - CHTMLB (configuration tags; these are available for forms, tables and trees)
    You should always use these tag libraries in the first place to assure common look and feel and avoid rendering issues.
    Best regards
    Peter

  • Accessing Element's name in Message mapping

    Hi,
       I need to Access the Element's name in Message mapping (Using graphical tool or in user defined function).
    For Example:
    Element: <Company_Name>XYZ Co </Company_Name>
    I need to access the Element's name(i.e.)<b>"Company_Name"</b>. So that I can map it as
    <Element>Company_Name</Element>
    <Element_Value>XYZ Co </Element_Value>
    in the target message.
    Kindly provide your inputs.

    Hi Santhosh,
    I am not sure if this can be done using your Graphical Mapping, but this is possible using JAVA mapping. Your SAX and DOM parsers for JAVA mapping provides methods like getChildNodes, getElementName using which you can get the name of the element.
    Check this link for the methods available for Java Mapping,
    http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html
    I think the same can also be done using XSL mapping. Though, I am not sure what method should be used for the same.
    Hope this helps,
    Regards,
    Bhavesh

  • How to access elements in main.mxml from ActionScript file?

    I am having difficulties creating a panel using the Extension Builder SDK. It seems that all the examples explain how to control a CS5 document using a panel, but I have not found any examples of how to control the elements of the panel via the ActionScript.   By the way we are using CS Extension Builder SDK with Flash Builder 4.  Here is a simple example of were I am getting stuck.
    I create a Extension builder project for a PS panel named: "CSExtensionTest".  In the main.mxml file a create a button with id="btnPSCode".
    File:
    main.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" historyManagementEnabled="false">
    <mx:Script>
                 <![CDATA[
    Bindable]
                        private var hostName:String = HostObject.mainExtension;
                 ]]>
          </mx:Script>
    <mx:VBox height="100%" width="100%" verticalAlign="middle" horizontalAlign="center">
    <mx:Button id="btnPSCode" label="Run PS code" click="CSExtensionTestPhotoshop.run()" enabled="{hostName.indexOf('photoshop') > -1}"/>
    <mx:Button id="btnJSXCode" label="Run JSX code" click="CSExtensionTestJSX.run()"/>
    </mx:VBox>
    </mx:Application>
    How can i get access to the properties of this element in the CSExtensionTesJSX.as file?
    File:  
    CSExtensionTesJSX.as
    package
    import com.adobe.csxs.core.CSXSInterface;
    import com.adobe.csxs.core.csxs_internal;
    import com.adobe.csxs.types.SyncRequestResult;
    import mx.binding.utils.BindingUtils;
    import mx.core.ButtonAsset;
    import mx.core.mx_internal;
    import mx.utils.object_proxy;
    public class CSExtensionTestJSX
    public static function run():void
    var myCSXS:CSXSInterface = CSXSInterface.getInstance();
    var result:SyncRequestResult = CSXSInterface.instance.evalScript("jsxFunction");
                        btnPSCode.enabled = false;   
    I'm getting this error:
    I had originally written a panel using a Flex Project and was able to access the properties of the elements of the main.mxml file directly.  It seems I can't do that anymore.  Am I missing something in the code?  Am I missing some type of library?  I'm sorry I am not very experienced in Adobe development, but we are trying to get more involved in developing plugins and extensions for CS5.  Any help will be greatly appreciated.

    Opps... My fault.  Just figured out waht was missing.
    I forgot to enter the following on the funciton line.
    public static function run(m:main):void
    Again Thank you.

  • Accessing a field in nested internal table

    Hi,
    Could you please help me how to get value in nested structure 'COMT_PRODUCT_IL_API'.
    We need to access field 'DESTINGUID' in that nested structure.
    Thanks,
    Santosh

    Helo,
    I figured the previous reply would have solved ur issue,
    but doesnt look like as you ve still kept the issue open.
    So il again as well follow d same lines n leave a snippet fr yu to refer:-
    DATA : LT_COMT_PRODUCT_IL_API TYPE TABLE OF  COMT_PRODUCT_IL_API,
                LW_COMT_PRODUCT_IL_API TYPE COMT_PRODUCT_IL_API,
    ** i AM NOT SURE WHCIH DEEP STRUCT it is, Im just picking one of the deep strucs in this struc**
                LW_COMM_IL_ACCESS  TYPE COMT_IL_ACCESS_MAINTAIN.
    LOOP AT LT_COMT_PRODUCT_IL_API INTO LW_COMT_PRODUCT_IL_API.
    READ TABLE LW_COMT_PRODUCT_IL_API-COMM_IL_ACCESS INTO LW_COMM_IL_ACCESS INDEX 1.
    IF SY-SUBRC = 0.
    +<UR CODE HERE>+
    ENDIF.
    ENDLOOP.
    Shoudl work.
    Please close the thread if ur issue lays resolved
    Regards
    Dedeepya C
    Edited by: dedeepya reddy on Mar 23, 2010 1:21 PM

  • Cannot access Elements 10 after purchase

    I downloaded the trial, and purchased Elements 10 yesterday 9.22.12. Used my same e-mail, BUT a different passcode and now I can't access the program because Adobe will not recognize the new passcode for the program and my account under my original passcode does not show Elements 10. Any Ideas?

    I don't think that there could have been an issue of passcodes. You can't use an incorrect passcode, to signing in; and the email id is unique. Two Adobe IDs cannot have the same email id.
    Did you receive an order confirmation and/or serial number in the email? (Just to be sure, check in the junk/spam folders as well, sometimes email filters mess up)
    Are you sure that the order was processed. If your card has been charged (i.e payment has been made), but you still haven't received your serial number, please get in touch with Adobe Support. They'll help you sort it out.

  • Adobe Error 150:30.  New HD in iMac now but can't access Elements 8

    Adobe Error 150:30.  Trying to access my Elements 8.  Recently replaced crashed HD in my iMac.  Would also like to upgrade to Elements 11.

    I've tried.  Do I need to uninstall first and start over?  And if I'm going to upgrade, do I need to do any of this or just do an upgrade to Elements 11?  Thanks!!

  • Controlling Element Tags using Nested Elements

    When I use the below I get:
    <?xml version = '1.0'?>
    <FSAATLAS>
    <STUDENT>
    <OBJECT_NAME>ADDRESS_T</OBJECT_NAME>
    <INNER_ELEMENT>
    <INNER_ELEMENT_ROW num="1">
    <DUMMY>X</DUMMY>
    </INNER_ELEMENT_ROW>
    </INNER_ELEMENT>
    </STUDENT>
    </FSAATLAS>
    How do I get the INNER_ELEMENT_ROW and num="1" from
    appearing in the NESTED ELEMENT!!!
    Best Regards,
    James Colestock
    import java.sql.*;
    import oracle.jdbc.OracleDriver;
    import oracle.xml.sql.query.*;
    import org.w3c.dom.*;
    import oracle.xml.parser.v2.*;
    public class XML {
    public XML() {
    private static final String QUERY = "select object_name, CURSOR(select dummy as dummy from dual) as INNER_ELEMENT from user_objects";
    public static void main(String[] args) throws Throwable {
    Connection c = getConnection();
    OracleXMLQuery q = new OracleXMLQuery(c,QUERY);
    q.setCollIdAttrName("");
    q.setCollIdAttr("");
    q.setRowIdAttrName("");
    q.setRowIdColumn("");
    q.setRowsetTag("FSAATLAS");
    q.setRowTag("STUDENT");
    q.useNullAttributeIndicator(false);
    q.useTypeForCollElemTag(false);
    String s = q.getXMLString();
    System.out.println(s);
    q.close();
    /*q = new OracleXMLQuery(c,QUERY);
    s = q.getXMLMetaData(OracleXMLQuery.SCHEMA,false);
    System.out.println(s);
    q.close();
    q = new OracleXMLQuery(c,QUERY);
    Document d = q.getXMLDOM(OracleXMLQuery.SCHEMA);
    ((XMLDocument)d).print(System.out);
    q.close();
    q = new OracleXMLQuery(c,QUERY);
    s = q.getXMLString(OracleXMLQuery.SCHEMA);
    System.out.println(s);*/
    public static Connection getConnection() throws SQLException {
    String username = " james";
    String password = "masterjames";
    String thinConn = "jdbc:oracle:thin:@localhost:1526:PORTLAND";
    Driver d = new OracleDriver();
    return DriverManager.getConnection(thinConn,username,password);
    }

    When I use the below I get:
    <?xml version = '1.0'?>
    <FSAATLAS>
    <STUDENT>
    <OBJECT_NAME>ADDRESS_T</OBJECT_NAME>
    <INNER_ELEMENT>
    <INNER_ELEMENT_ROW num="1">
    <DUMMY>X</DUMMY>
    </INNER_ELEMENT_ROW>
    </INNER_ELEMENT>
    </STUDENT>
    </FSAATLAS>
    How do I get the INNER_ELEMENT_ROW and num="1" from
    appearing in the NESTED ELEMENT!!!
    Best Regards,
    James Colestock
    import java.sql.*;
    import oracle.jdbc.OracleDriver;
    import oracle.xml.sql.query.*;
    import org.w3c.dom.*;
    import oracle.xml.parser.v2.*;
    public class XML {
    public XML() {
    private static final String QUERY = "select object_name, CURSOR(select dummy as dummy from dual) as INNER_ELEMENT from user_objects";
    public static void main(String[] args) throws Throwable {
    Connection c = getConnection();
    OracleXMLQuery q = new OracleXMLQuery(c,QUERY);
    q.setCollIdAttrName("");
    q.setCollIdAttr("");
    q.setRowIdAttrName("");
    q.setRowIdColumn("");
    q.setRowsetTag("FSAATLAS");
    q.setRowTag("STUDENT");
    q.useNullAttributeIndicator(false);
    q.useTypeForCollElemTag(false);
    String s = q.getXMLString();
    System.out.println(s);
    q.close();
    /*q = new OracleXMLQuery(c,QUERY);
    s = q.getXMLMetaData(OracleXMLQuery.SCHEMA,false);
    System.out.println(s);
    q.close();
    q = new OracleXMLQuery(c,QUERY);
    Document d = q.getXMLDOM(OracleXMLQuery.SCHEMA);
    ((XMLDocument)d).print(System.out);
    q.close();
    q = new OracleXMLQuery(c,QUERY);
    s = q.getXMLString(OracleXMLQuery.SCHEMA);
    System.out.println(s);*/
    public static Connection getConnection() throws SQLException {
    String username = " james";
    String password = "masterjames";
    String thinConn = "jdbc:oracle:thin:@localhost:1526:PORTLAND";
    Driver d = new OracleDriver();
    return DriverManager.getConnection(thinConn,username,password);
    }

Maybe you are looking for

  • Safari and Firefox seem to have been hijacked

    Safari and Firefox seem to have been hijacked. When I type hotmail it takes me to some netgear wn2500rp genie. Help!

  • Counting the number of selected Checkboxes in Numbers.

    I imagine this is very simple, however I can't seem to find a way to simply add up the number of checked check boxes in a row. Problem: I have a table with a number of objectives that I need to be able to mark as done. My rows are the objectives and

  • Database upgradation from 10.2.0.3 to 11 R2

    Hi I am planning to upgrade my production database from 10.2.0.3 to 11.2. Before doing into production am testing it into our Test server in Linux OS. I got manual procedure of database upgradation from metalink. I installed Oracle 11g as software on

  • User only application Folder - Dockulicious

    I just noticed there is no application folder for just the user. Can I just set one up and place applications in it that only I have access to. Will this effect how the program performs? I was looking at the Dockulicious Docks apps which is really co

  • Project stalls after second question slide

    The project (swf file) keeps freezing on the second quiz question. if i start the project on another slide, it still freezes on the second question slide presented. I have cleared the cashe, tried setting it to a survey question. tried rebuilding the