For Loop in Struts ?(without  Container)

Hi all,
Pls tell me how can v use for loop in JSP struts without using scriplets and container .
suppose i want to display 20 times "hello world "in jsp .How can i display it using STRUTS as conventionally scriplets are not allowed in it.
and Iterator is only for Container .
thanx

Hi all,
Pls tell me how can v use for loop in JSP struts without using scriplets and container .
suppose i want to display 20 times "hello world "in jsp .How can i display it using STRUTS as conventionally scriplets are not allowed in it.
and Iterator is only for Container .
thanx

Similar Messages

  • For Loop in Struts ?(without Collections)

    Hi all,
    Pls tell me how can v use FOR LOOP IN JSP STRUTS without using scriplets and collections .
    suppose i want to display 20 times "hello world "in jsp .How can i display it using STRUTS as conventionally scriplets are not allowed in it.
    and Iterator is only for Collections .
    thanx

    TestBean.java
    * $Id: TestBean.java 54929 2004-10-16 16:38:42Z germuska $
    * Copyright 1999-2004 The Apache Software Foundation.
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    * http://www.apache.org/licenses/LICENSE-2.0
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    package org.apache.struts.webapp.exercise;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    import java.util.Vector;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.util.LabelValueBean;
    * General purpose test bean for Struts custom tag tests.
    * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
    public class TestBean extends ActionForm {
    // ------------------------------------------------------------- Properties
    * A collection property where the elements of the collection are
    * of type <code>LabelValueBean</code>.
    private Collection beanCollection = null;
    public Collection getBeanCollection() {
    if (beanCollection == null) {
    Vector entries = new Vector(10);
    entries.add(new LabelValueBean("Label 0", "Value 0"));
    entries.add(new LabelValueBean("Label 1", "Value 1"));
    entries.add(new LabelValueBean("Label 2", "Value 2"));
    entries.add(new LabelValueBean("Label 3", "Value 3"));
    entries.add(new LabelValueBean("Label 4", "Value 4"));
    entries.add(new LabelValueBean("Label 5", "Value 5"));
    entries.add(new LabelValueBean("Label 6", "Value 6"));
    entries.add(new LabelValueBean("Label 7", "Value 7"));
    entries.add(new LabelValueBean("Label 8", "Value 8"));
    entries.add(new LabelValueBean("Label 9", "Value 9"));
    beanCollection = entries;
    return (beanCollection);
    public void setBeanCollection(Collection beanCollection) {
    this.beanCollection = beanCollection;
    * A multiple-String SELECT element using a bean collection.
    private String[] beanCollectionSelect = { "Value 1", "Value 3",
    "Value 5" };
    public String[] getBeanCollectionSelect() {
    return (this.beanCollectionSelect);
    public void setBeanCollectionSelect(String beanCollectionSelect[]) {
    this.beanCollectionSelect = beanCollectionSelect;
    * A boolean property whose initial value is true.
    private boolean booleanProperty = true;
    public boolean getBooleanProperty() {
    return (booleanProperty);
    public void setBooleanProperty(boolean booleanProperty) {
    this.booleanProperty = booleanProperty;
    * A multiple-String SELECT element using a collection.
    private String[] collectionSelect = { "Value 2", "Value 4",
    "Value 6" };
    public String[] getCollectionSelect() {
    return (this.collectionSelect);
    public void setCollectionSelect(String collectionSelect[]) {
    this.collectionSelect = collectionSelect;
    * A double property.
    private double doubleProperty = 321.0;
    public double getDoubleProperty() {
    return (this.doubleProperty);
    public void setDoubleProperty(double doubleProperty) {
    this.doubleProperty = doubleProperty;
    * A boolean property whose initial value is false
    private boolean falseProperty = false;
    public boolean getFalseProperty() {
    return (falseProperty);
    public void setFalseProperty(boolean falseProperty) {
    this.falseProperty = falseProperty;
    * A float property.
    private float floatProperty = (float) 123.0;
    public float getFloatProperty() {
    return (this.floatProperty);
    public void setFloatProperty(float floatProperty) {
    this.floatProperty = floatProperty;
    * Integer arrays that are accessed as an array as well as indexed.
    private int intArray[] = { 0, 10, 20, 30, 40 };
    public int[] getIntArray() {
    return (this.intArray);
    public void setIntArray(int intArray[]) {
    this.intArray = intArray;
    private int intIndexed[] = { 0, 10, 20, 30, 40 };
    public int getIntIndexed(int index) {
    return (intIndexed[index]);
    public void setIntIndexed(int index, int value) {
    intIndexed[index] = value;
    private int intMultibox[] = new int[0];
    public int[] getIntMultibox() {
    return (this.intMultibox);
    public void setIntMultibox(int intMultibox[]) {
    this.intMultibox = intMultibox;
    * An integer property.
    private int intProperty = 123;
    public int getIntProperty() {
    return (this.intProperty);
    public void setIntProperty(int intProperty) {
    this.intProperty = intProperty;
    * A long property.
    private long longProperty = 321;
    public long getLongProperty() {
    return (this.longProperty);
    public void setLongProperty(long longProperty) {
    this.longProperty = longProperty;
    * A multiple-String SELECT element.
    private String[] multipleSelect = { "Multiple 3", "Multiple 5",
    "Multiple 7" };
    public String[] getMultipleSelect() {
    return (this.multipleSelect);
    public void setMultipleSelect(String multipleSelect[]) {
    this.multipleSelect = multipleSelect;
    * A nested reference to another test bean (populated as needed).
    private TestBean nested = null;
    public TestBean getNested() {
    if (nested == null)
    nested = new TestBean();
    return (nested);
    * A String property with an initial value of null.
    private String nullProperty = null;
    public String getNullProperty() {
    return (this.nullProperty);
    public void setNullProperty(String nullProperty) {
    this.nullProperty = nullProperty;
    * A short property.
    private short shortProperty = (short) 987;
    public short getShortProperty() {
    return (this.shortProperty);
    public void setShortProperty(short shortProperty) {
    this.shortProperty = shortProperty;
    * A single-String value for a SELECT element.
    private String singleSelect = "Single 5";
    public String getSingleSelect() {
    return (this.singleSelect);
    public void setSingleSelect(String singleSelect) {
    this.singleSelect = singleSelect;
    * String arrays that are accessed as an array as well as indexed.
    private String stringArray[] =
    { "String 0", "String 1", "String 2", "String 3", "String 4" };
    public String[] getStringArray() {
    return (this.stringArray);
    public void setStringArray(String stringArray[]) {
    this.stringArray = stringArray;
    private String stringIndexed[] =
    { "String 0", "String 1", "String 2", "String 3", "String 4" };
    public String getStringIndexed(int index) {
    return (stringIndexed[index]);
    public void setStringIndexed(int index, String value) {
    stringIndexed[index] = value;
    private String stringMultibox[] = new String[0];
    public String[] getStringMultibox() {
    return (this.stringMultibox);
    public void setStringMultibox(String stringMultibox[]) {
    this.stringMultibox = stringMultibox;
    * A String property.
    private String stringProperty = "This is a string";
    public String getStringProperty() {
    return (this.stringProperty);
    public void setStringProperty(String stringProperty) {
    this.stringProperty = stringProperty;
    * An empty String property.
    private String emptyStringProperty = "";
    public String getEmptyStringProperty() {
    return (this.emptyStringProperty);
    public void setEmptyStringProperty(String emptyStringProperty) {
    this.emptyStringProperty = emptyStringProperty;
    * A single-String value for a SELECT element based on resource strings.
    private String resourcesSelect = "Resources 2";
    public String getResourcesSelect() {
    return (this.resourcesSelect);
    public void setResourcesSelect(String resourcesSelect) {
    this.resourcesSelect = resourcesSelect;
    * A property that allows a null value but is still used in a SELECT.
    private String withNulls = null;
    public String getWithNulls() {
    return (this.withNulls);
    public void setWithNulls(String withNulls) {
    this.withNulls = withNulls;
    * A List property.
    private List listProperty = null;
    public List getListProperty() {
    if (listProperty == null) {
    listProperty = new ArrayList();
    listProperty.add("dummy");
    return listProperty;
    public void setListProperty(List listProperty) {
    this.listProperty = listProperty;
    * An empty List property.
    private List emptyListProperty = null;
    public List getEmptyListProperty() {
    if (emptyListProperty == null) {
    emptyListProperty = new ArrayList();
    return emptyListProperty;
    public void setEmptyListProperty(List emptyListProperty) {
    this.emptyListProperty = emptyListProperty;
    * A Map property.
    private Map mapProperty = null;
    public Map getMapProperty() {
    if (mapProperty == null) {
    mapProperty = new HashMap();
    mapProperty.put("dummy", "dummy");
    return mapProperty;
    public void setMapProperty(Map mapProperty) {
    this.mapProperty = mapProperty;
    * An empty Map property.
    private Map emptyMapProperty = null;
    public Map getEmptyMapProperty() {
    if (emptyMapProperty == null) {
    emptyMapProperty = new HashMap();
    return emptyMapProperty;
    public void setEmptyMapProperty(Map emptyMapProperty) {
    this.emptyMapProperty = emptyMapProperty;
    // --------------------------------------------------------- Public Methods
    * Reset the properties that will be received as input.
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    booleanProperty = false;
    collectionSelect = new String[0];
    intMultibox = new int[0];
    multipleSelect = new String[0];
    stringMultibox = new String[0];
    if (nested != null)
    nested.reset(mapping, request);
    }

  • For loop 1 iteration execution time

    Hi,
    what is the time taken of for loop 1 iteration without code inside.How to calculate this Execution time.

    Ravindranath.K wrote:
    Hi,
    what is the time taken of for loop 1 iteration without code inside.How to calculate this Execution time.
    No code in the FOR loop?  It will not use any time because the compiler will optimize it out.
    Why do you even need to know?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to iterate List in jsp without using for loop

    Hi,
    I am developing a small application is struts. I have one ActionForm file which contain one List like getEmployeeDetailsList(). When I am using this list in jsp page for displaying data. I want to display it as employee name, employee address, employee designation and employee contact no. These all fields are available in the above list. Now what is the problem is that I am using logic:iterate method to iterate data. but this is not sufficient to display all records in order. like employee name should be in one table and they can be vertical not horizontal, employee address is also should be seperate. and same thing with employee designation and contact no. I don't want to use for loop to iterate this list. Please tell me about optionCollection for this list. only employee names should be one drop down and employee designation is also in another drop down.
    Please help. It is really urgent.
    Any help will be appreciated.
    Thanks in advance.
    Manveer

    I'm not sure what you problem is, but one thing you can do is to create a new class and pass the list into its constructor (and store it as a private variable). Then, provide a set of functions in the new class that extracts data from the list and returns it in a form that the various parts of the JSP page wants. For example, one function may return a sorted list of just the employee names. In this way, all the business logic for formatting the data into a form that JSP page likes is hidden inside the new class.

  • For loop without N input

    Hi Guys,
    I have looked at the I/O example and found that the for loop in the example can exist without an input of N. I tried the same thing in the VI created by myself. I think the problem is the type of the tunnel. Can I change the input tunnel into a indexed tunnel? I right-click the tunnel and there is no option to change the tunnel into a auto-indexed one. 
    Attachments:
    loop_test.vi ‏6 KB

    Have you looked at the LabVIEW Help? This is explained in there.
    To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the _

  • Facing problem in saving data without overlapping in for loop

    Hi,
    I am facing problem in writting data withou overlapping if i run outer loop for 2 or more times and in inner for loop i am getting array in a way I want but when i try to build that array with logging temperature i am not able to do it. Please guide me through ths.
    Thank You
    Hnagpal
    Solved!
    Go to Solution.
    Attachments:
    data storage.vi ‏31 KB
    what i am getting.xlsx ‏10 KB
    what i want.xlsx ‏10 KB

    Thanks odessy27, Matthew Kelton, for replying.
    Matthew Kelton: Thanks for the solution i am adding outer loop so that i can increase the number of row. I am using it for some application which require me to save data several time and i used random number here but originally instead of random number there will be power meter reading and i want to save it every hour and plot it. I am also attaching a file what i made I don't know is this a good way or not. Actually i will also beneeded to plot a graph. But again how to increase a row and without replacing previous data i can write another row.
    Yes i want to make one row for each iteration.
    I attached both files in 2009 version.
    Thank You
    Himanshu Nagpal 
    Attachments:
    desired result.xlsx ‏10 KB
    data storage (1).vi ‏26 KB
    data storage.vi ‏37 KB

  • Can a waveform graph be used without for loop

    i would like to know if a waveform graph can be used without a for loop and if so, how? I tried using a while loop only, but the reading becomes too fast.
    can someone advise

    Dear nebb,
    first of all, graph is usually an offline plot of the acquired data but to use it as an online display u need to use build arrays in for/while loop which keeps on adding new points & plots in waveform graph.
    I am including a vi which incorporates a while loop in which by using build array, points keep on increasing & simultaneously they are plotted in the waveform graph.
    Using for or while loop, it has no concern with speed. it depends on the code inside the loop which makes them faster or slower.
    For making slow readings, you can put some delay inside while looping.
    Hope this works. YOur feedbacks are welcome.
    Best Regards,
    Nirmal Sharma
    India
    Attachments:
    waveform_graph_without_for_loop.vi ‏17 KB

  • Making 2 for loops without nested

    How to make two for loops without nested like the follwoing
    for i in 1.10, j in 1..30 loop
    end loop
    Please help me

    Following is the closest I could think of...
    SQL> ed
    Wrote file afiedt.buf
    1 declare
    2 type myrec is record (ctr1 number, ctr2 number);
    3 type tabrec is table of myrec ;
    4 v_tabrec tabrec := new tabrec();
    5 begin
    6 for i in 1..10 loop
    7 v_tabrec.extend;
    8 v_tabrec(i).ctr1 := i;
    9 v_tabrec(i).ctr2 := i;
    10 end loop;
    11 for i in 11..30 loop
    12 v_tabrec.extend;
    13 v_tabrec(i).ctr2 := i;
    14 end loop;
    15 for i in v_tabrec.first..v_tabrec.last loop
    16 dbms_output.put_line(v_tabrec(i).ctr1 || v_tabrec(i).ctr2);
    17 end loop;
    18* end;
    SQL> /
    11
    22
    33
    44
    55
    66
    77
    88
    99
    1010
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30

  • For loop container in SSIS

    i have 1 sequence container.
    in that i have data flow task,in which oledb source ->rowcount(I am counting total rows into vaiable)(@rowcount)
    now i have for loop container ,in which i am using this variable, but its coming 0  here.
    @Counter=0
    @Counter<@rowcount
    @Counter = @Counter+1
    i can see from DATA flow task that 100 rows is going into row count.
    ANY HELP?

    In DF, after Row Count transformation you have to use Recordset Destination like below:
    SSIS #104 – When Row Count Transformation is invaluable
    Other option:
    You can use Execute SQL Task inside Control Flow. Write a query SELECT COUNT(*) AS MyCount FROM YourTable
    Set Result Set: Single Row.
    Save the MyCount to @rowcount Variable.
    Connect Execute SQL Task to For Loop Container.
    Cheers,
    Vaibhav Chaudhari

  • Convert array of clusters to cluster of arrays without for loop

    Hi!
    Here's a problem: I've got an array of clusters (array of messages). Each cluster consists of elements of different data types: double (time), cluster (parameters), char (station id), byte (message code). I know one cluster size and the array size. I need to draw a time graph. How can I convert the array of clusters to a cluster of arrays (array of time values, array of parameters clusters, arrays of chars and bytes).
    I post this question because in my real array of clusters each cluster consists of 162 elements and some of them are clusters themselves, so I realy dont want to wire "for" loops as was advised in other topics.
    Hope to get fresh ideas. Memory management? Type Cast? FlatternStrings and variants? Anything!
    Thank you. 

    Idea wrote:
    Hi, everybody! Glad you read the post! 
    There is the cluster in the attachment. The application I make is a TCP client. The cluster is a message. Actually I get a string, find edges ("DIAG" - begin, "GAID" - end) and then I use "unflattern to string" for making the cluster. I cann't make another structure of the message - I didn't make the server. My client has a buffer of recieved messages. I need to plot graphs of different cluster elements for all messages in my buffer (for example the Time 1 element). If I use the for loop it would be too slow. The idea was to convert all buffer to a 2D array of U8 and then use type cast to get the cluster of arrays. Then it would be easy to take ane cluster element and send it to graph.
    I didn't sucseed yet. 
    Idea. 
    What is your question about?
    A) convert the string you get from I don't know where to the giant cluster, the red part in your message, or
    B) making a graph out of some element from that giant cluster, who now is in an array, the blue part in your message.
    The code you showed us looks a solution for question A but no loop is needed for this. So why bother about a loop that would be too slow here?
    Also your code start from an array of U8, so where's the string?
    If you could provide a string that needs conversion, we could try another way ... ...
    Question B can easily be solved with a for loop and "unbundle by name". Don't know where you get the idea that a loop would be too slow
    Open G library has a lot of VI's to retrieve specific elements from clusters, maybe one of those could help solve the problem.

  • Writing data to spreadsheet in FOR loop without shift register

    My program has a case window within a For loop.  The loop iteration index is wired to the case, so there’s a case for each iteration of the loop (about 30 cases).  In each case, data points are gathered, formatted to a spreadsheet and written to a file, along with some occasional header strings to describe the data.  This works fine, as I can simply write the data to file as soon as I get it. 
    At some point in the loop, I’m gathering from two sources (rpm data for two fans) over several iterations that is to be written to two separate but similar formatted tables in the same output file.  Since I’m writing two tables to one file simultaneously, I can no longer write on-the-fly in a linear fashion; I’d need to store all the information until I complete the iterations, then format the header & raw data to spreadsheet and write to file in two chunks – at least, this is what I believe is the way to go, but I’m all ears if there’s another way.
    In order to buffer the data, I could use a shift register, but this requires me to wire an array across my loop for all loops, whether I’ll be using it or not.  I’ve also considered initializing an array at the case I’ll need to start buffering, then writing to a local variable of that array, but in fiddling with this approach, I don’t see how to specify what index to which I’m storing the data point.
    So I’m looking for advice on whether (1) there’s another way to accomplish my goal and/or (2) how to execute the initialize array and local variable approach. 
    Below is a picture of what I want this portion of the spreadsheet to look like.  Also included is a much abbreviated mock-up of my program for a case where I’m writing on the fly for a single table or column of information and a case where I’m setting up the write to local variable approach.  
    Message Edited by TESTIE on 04-03-2008 12:48 PM
    Attachments:
    illustration22.JPG ‏52 KB
    output_file2.JPG ‏120 KB
    illustration3.JPG ‏50 KB

    An Action Engine can thought of as an encapsulated shift register.
    AE's out-perform locals while alos elliminating possible race conditions. You may want to review the Nugget I wrote on Action Engines.
    Just trying to help,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to pass the sequence number of current loop in a for loop in FPGA vi to the host

    PCI-7830R
    LV 8.2
    What I was trying to do is to use multiple DIO to generate pulse at different sequence. Mode one is to automatically sweep from DIO1 to DIO20; mode 2 is several DIOs generate pulse simoutaneously.  So I use a case structure to make the selection, in the mean time, I set up two for loop in each case so that I can use multiple pulse generations. For example, in scanning mode, if I set 2 exposures, it sweeps from 1 to 20 then do it again.  
    Then I need to get the loop sequence number, i of each scenario. So I put an indicator within the first loop, and create a local variable of it and put in the second one.  Running the FPGA vi alone, I can see the indicator change in each case from 0 to N-1, N being the for loop time.But in the host vi, I tried to add this indicator as an element in the read/write invoke method, in the debugging mode, I could only see it directly jump to N-1 without all the changes I saw in FPGA vi. 
    Is it possible to get this number passed correctly from FPGA vi to the host vi? Thanks

    Thanks for the reply Jared.
    Excuse me if it looks incorrect, but I'm new to FPGA programming, so I would have to look into the FIFO you referred to.  I used local variables because for one thing I have several different cases containing for loop in each of them, and I only want one indicator for the "i".  If I put the indicator out of any for loop, it's only gonna show the last number which is N-1.  For the other thing, it seems like property nodes are not allowed in FPGA vi.  And by doing this, I can see the i number changing from 0 to N-1 in each case, well, in FPGA vi's front panel.  But while I ran the host vi with everything, the indicator in host vi's front panel only showed the last number N-1. It may be the reason you said, it happened too fast before the indicator in host vi can catch it.
    What I want to realize is to group the data I collect in host vi, for example, when I choose multiple exposure in each mode, and the FPGA runs 1 through 20 then do it again, I want the data stored in two groups using the loop sequence number as the seperator in file name.  So it goes like 1-1, 2-1.......20-1; then 1-2, 2-2,.....20-2.

  • Add loops to Arrange without sync Pitch and Tempo

    I recently purchased a package of Audio loops. This package contained audio files in wav and AIFF format. I tried to add the AIFF loops to Loop browser and Logic but it didn't work. The pitch of the loops would change as I dragged them toward the arranment. So I removed them from the loop browser and tried to use the wav files dragging them from the File Folder and when the only to get the same results. It's strange because when I play them on itunes or other programs they're in the right pitch, but as soon as I transfer them to logic the pitch changes.
    How can I use these loops in Logic without changing the pitch?

    If they are Apple loops...
    Use the aiff versions.. and select the region created when you added the loop... Now use transpose in the Region Inspector on the left of the Arrange window..  to set the loop to play at the correct pitch for your piece.
    If they are not Apple loops.. use the transpose function as described above and then stretch/flex the region to fit the tempo of your piece.

  • Why won't for loop execute?

    Can anyone tell me why this for loop won't execute in "Security System".  Basically I was practicing for the  CLD exam by writing the "Security System" practice exam.  I wanted to try the Event-Driven State Machine with a queue.  My problem is that in the "Check Alarm", "Check Bypass", and "Check Tamper" states, I have a for loop which is indexed with 4 - 6 element arrays.  The for loop will not execute 6 times.  It won't even execute once.  It just skips over the for loop and outputs all boolean falses and zeros for the numeric values.  Is this a Labview glitch of some sort?
    Thanks for any replies.
    Matt Koebel
    Attachments:
    Security System.zip ‏108 KB

    tst wrote:
    Without looking at the code, my guess would be that one of the indexing inputs into the loop is 0.
    More precisely ".. is an array of size zero.
    (1) Go to yout three boolean arrays and click on the 6th element to make the arrays size=6 with all FALSE. now make current values default and save the VI.
    (2) You also need to wire the boolean arrays across all event cases  to ensure the current values are kept in the shift register. RIght now a change in one array resets the others to an empty array again.
    (3) now initialize a boolean array containing six FALSE and initialize the shift registers with it. 
    Message Edited by altenbach on 10-22-2008 11:55 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Infinite for loop

    hi
    I have the following for loop:
    for (TreeMap <String, Integer> i = result; i.size()!=0; i.headMap (i.lastKey()))
    {out.println("keyword = " + i.lastKey() + " ; page no. = " + i.get(i.lastKey()));
    result is a tree map that contains several strings (the keys) and integers (values).
    I need to note that in the process of creating result some values (i.e. strings) were repeated and therefore their values were replaced (run over).
    When I run the program it just perform the loop again and again without getting rid of the last value / key pair in i in every iteration.
    Can anyone explain why this is?
    thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    hi
    I have the following for loop:
    for (TreeMap <String, Integer> i = result; i.size()!=0; i.headMap (i.lastKey()))
    {out.println("keyword = " + i.lastKey() + " ; page no. = " + i.get(i.lastKey()));
    result is a tree map that contains several strings (the keys) and integers (values).I need to note that in the process of creating result some values (i.e. strings) were repeated and therefore their values were replaced (run over).
    When I run the program it just perform the loop again and again without getting rid of the last value / key pair in i in every iteration.
    Can anyone explain why this is?
    thanks in advance.

Maybe you are looking for