array parameter bug?

Jun Yamog <[email protected]>
Newsgroups gmane.linux.redhat.ccm.general
Message-ID <[email protected]>
Hi,

I would like to ask if there is a bug in ArrayParamter.  Using a
MultipleSelect or an ArrayParameter as a Global state param makes the
values grow larger and larger.  I have a test code that I have written
below to show this.  I really need this in a real world scenario.  In
the real world I have a form that serves as a filter of the paginated
results.  What happens is after a couple of filters the query string
gets too long.  I have tried several work-arounds, like using hidden var
and repopulating the multiple select. I think it boils that if the var
is a global and array parameter.  I need it as global since external
stuff uses the form and also so the paginator can pickup the current
state of the filter form.  

Try the code below, you can comment out "addGlobalStateParam" and see
that it does not happen anymore.  Is this a bug or am I not using
MultipleSelect properly? Thanks very much.


Jun


public class TestPage extends Page {
    
    private Form m_form = new Form("testform");
    private MultipleSelect m_sel = new MultipleSelect("testselect");

    public TestPage() {
        super();
        buildForm();        
        buildTestLabel();
        addGlobalStateParam(m_sel.getParameterModel()); 

        lock();
    }
        
    private void buildForm() {
        m_form.setMethod("GET");
        
        m_sel.addOption(new Option("1", "test1"));
        m_sel.addOption(new Option("2", "test2"));
        m_sel.addOption(new Option("3", "test3"));
        m_sel.addOption(new Option("4", "test4"));
        m_sel.addOption(new Option("5", "test5"));
        m_sel.addOption(new Option("6", "test6"));
        m_form.add(m_sel);
        
        Submit submit = new Submit("Test!");
        m_form.add(submit);
        
        add(m_form);
    }
    
    private void buildTestLabel() {
        final Label tlabel = new Label("Test Label");
        tlabel.addPrintListener(new PrintListener() {
            public void prepare(PrintEvent event) {
                PageState state = event.getPageState();
                tlabel.setLabel(state.toURL().getQueryString(),state);
            }
        });
        
        add(tlabel);
    }

}



-- 
Redhat-ccm-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/redhat-ccm-list
Archives: https://www.redhat.com/pipermail/redhat-ccm-list/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.