tags:

views:

49

answers:

0

In STruts, i am trying to hold the Lst value in hidden.This lst value should be available untill the user clicks on clear button.When user clicks on find, seach conditions options get added into this list. how do i have to implement this.?For me what happening is that, List object is added as another List..[[[]]] as result..my code is,

<s:hidden name="filterConditions" ></s:hidden>
            <s:iterator id="getCriteria"
                status="row" value="filterConditions">
                <!--<s:hidden name="filterConditions[%{#row.index}].attributeName"
                    value="%{attributeName}" />
                <s:hidden name="filterConditions[%{#row.index}].filterOption"
                    value="%{filterOption}" />
                <s:hidden name="filterConditions[%{#row.index}].attributeValue"
                    value="%{attributeValue}" />
                -->
                <s:text name="getCriteria[%{#row.index}].attributeName"></s:text>
                <s:text name="getCriteria[%{#row.index}].filterOption"></s:text>
                <s:text name="getCriteria[%{#row.index}].attributeValue"></s:text>

        </s:iterator>


private FilterCriteria filterCondtion;

    private List filterConditions = null;

/**
     * @return the filterConditions
     */
    public List getFilterConditions() {
        return filterConditions;
    }

    /**
     * @param filterConditions
     *        the filterConditions to set
     */
    public void setFilterConditions(List filterConditions) {
        System.out.println("Set object"+filterConditions);
        this.filterConditions = filterConditions;
    }

    public FilterCriteria getCriteria(int index) {
        // make sure that orderList is not null
        if (this.filterConditions == null) {
            System.out.println("hio");
            this.filterConditions = new ArrayList();
        }

        // indexes to not come in order, populate empty spots
        while (index >= this.filterConditions.size()) {
            System.out.println("creating object for index");
            this.filterConditions.add(new FilterCriteria());
        }

        // return the requested item
        return (FilterCriteria) filterConditions.get(index);
    }