HOW DO I IMPLEMENT THIS USING LOGIC TAGS.........

Discussions

Web tier: servlets, JSP, Web frameworks: HOW DO I IMPLEMENT THIS USING LOGIC TAGS.........

  1. HOW DO I IMPLEMENT THIS USING LOGIC TAGS......... (2 messages)

    hi,

    i am having 2 listboxes - i allow the user to transfer values from the left to the right and then save the right list box values.....i have implemented the populating of the list boxes and then saving and retrieving those values....everythng works perfect....

    NOW, i want to implement this and i am not quite sure how to do this...I would appreciate any help...

    WHAT I WANT TO DO:

    When i display the listboxes jsp again after the user has done some transferring of values and saving, i want to display only the values that have not been transferred from left to right...i.e., the values that were remaining after some of the values have been transferred to right?...HOW DO I IMPLEMENT THIS USING LOGIC TAGS

    this is my code for the left listbox
    <bean:define id="globalFields" name="AddColumnFormBean" property="globalExtensionFields" />
    <html:select multiple="true" size="9" style="width: 58mm" styleId="list1" tabindex="1"
    ondblclick="opt.transferRight()"
    name="AddColumnFormBean" property="leftGExtensionFields">
    <html:options collection="globalFields" property="code" labelProperty="description"/>

    for the right:
    <html:select multiple="true" size="9" style="width: 58mm" styleId="list2" tabindex="2"
                ondblclick="opt.transferLeft()"
    name="AddColumnFormBean" property="newGExtensionFields">
    <bean:define id="rightGlobalFields" name="AddColumnFormBean" property="newGlobalExtensionFields"/>
    <!-- <html:option value="G/S ID">G/S ID</html:option>
    <html:option value="G/S Name">G/S Name</html:option> -->
    <html:options collection="rightGlobalFields" property="code" labelProperty="description"/>
    </html:select>

    thanks very much
    </html:select>

    Threaded Messages (2)

  2. Use your formbean![ Go to top ]

    I'm not sure if understand you question correctly but I believe you are trying to write code to remember the state of your two list boxes.

    I believe your problem is the fact that you are using the html:options tag to populate your list box within the jsp. This will infact resets your list box to the contents of the collection provided to the options tag everytime you reload this page.

    Instead, I suggest you initialize your form bean attributes "leftGExtensionFields" and "newGExtensionFields" within the form bean itself (upon declaration) and use the "session" scope (within struts-config.xml) for this action if necessary.
  3. Use your formbean![ Go to top ]

    This is what i have done in the same situation.

                           I store the values of both the lists in a hashmap and hasmap consist of the KEY and value pair.The key is nothing but the Item that needs to be shown on the boxes and the value is the some Object which contains some contains this key,flag and other attributes.

                            Now when the user selects the ITEM to be removed, i will go to the hashmap and remove the entry form the hashMAp that user selected and add this Item to the other HashMap.

                               If you don't want to loose the information that you deleted from the HashMaps, just update the Flag(make it like INACTIVE from ACTIVE) and while displaying in the JSP, only show the enteries with the flag as ACTIVE.
                               That will do for your need.

    cheers Mandeep.