I am using the DynamicSelectionList (Tap 3) component managed at the Tassel site http://equalitylearning.org/Tassel/app?service=direct/1/ Search/viewComponent&sp=SmatmshDynamicSelectionList

I followed the BikeMaker demo with source code at http:// lombok.demon.co.uk/tapestryDemo/welcome

The BikeMaker example above uses StringPropertySelectionModel and String[] objects for the drop-down selection lists. However, I modified my program to use custom PropertySelectionModel(s) and custom objects as value objects in the models.

On the first render of the page, the DynamicSelectionList component works exactly what I want to achieve. The options and their labels are displayed correctly in the selection lists, and selecting an option in the parent list reflects the correct items in the child list. The problem is there is an ArrayIndexOutOfBoundsException while trying the submit the form. Following the trace and component source tells me that it is trying to retrieve an object at -1 position. I am not sure why.

Has anyone encountered this problem before using custom objects for the DynamicSelectionList component (Tap 3)? I have attached the source code of the page and also the stack trace. Please let me know if there's anything you need to figure out this problem. Thanks.

-waimun

/* start of source */

public abstract class AddReferral extends BasePage implements
                PageRenderListener {

        public abstract UserDepartmentDao getUserDepartmentDao();

        public abstract IPropertySelectionModel getDepartmentSelectionModel();

        public abstract void setDepartmentSelectionModel(
                        IPropertySelectionModel selectionModel);

        public abstract UserAccountDao getUserAccountDao();

        public abstract List getUsersByDepartmentList();

        public abstract void setUsersByDepartmentList(List users);

        public void pageBeginRender(PageEvent event) {

                List allDepartments = getUserDepartmentDao().findAll();

                if (getDepartmentSelectionModel() == null) {
                        setDepartmentSelectionModel(new 
DepartmentSelectionModel(
                                        allDepartments));
                }

                // get users by department from the department selection model.

DepartmentSelectionModel deptModel = (DepartmentSelectionModel) getDepartmentSelectionModel();

                for (Iterator it = deptModel.getDepartmentList().iterator(); it
                                .hasNext();) {

                        List usersByDepartment = null;

                        UserDepartment d = (UserDepartment) it.next();

                        usersByDepartment = 
getUserAccountDao().findByDepartment(d);

                        getUsersByDepartmentList().add(
                                        new 
UsersByDepartmentSelectionModel(usersByDepartment));

                }

        }

}

/* end of source */

/*
Stack Trace:

    * java.util.ArrayList.get(ArrayList.java:323)
* man.library.components.dynamicSelectionList.DynamicSelectionList.getChil dModel(DynamicSelectionList.java:309) * man.library.components.dynamicSelectionList.DynamicSelectionList.updateV alue(DynamicSelectionList.java:189) * man.library.components.dynamicSelectionList.DynamicSelectionList.renderC omponent(DynamicSelectionList.java:126) * org.apache.tapestry.AbstractComponent.render (AbstractComponent.java:857) * org.apache.tapestry.AbstractComponent.renderBody (AbstractComponent.java:624)
    * org.apache.tapestry.form.Form.renderComponent(Form.java:362)
* org.apache.tapestry.AbstractComponent.render (AbstractComponent.java:857)
    * org.apache.tapestry.form.Form.rewind(Form.java:568)
* org.apache.tapestry.engine.RequestCycle.rewindForm (RequestCycle.java:432)
    * org.apache.tapestry.form.Form.trigger(Form.java:582)
* org.apache.tapestry.engine.DirectService.service (DirectService.java:169) * org.apache.tapestry.engine.AbstractEngine.service (AbstractEngine.java:889) * org.apache.tapestry.ApplicationServlet.doService (ApplicationServlet.java:198) * org.apache.tapestry.ApplicationServlet.doPost (ApplicationServlet.java:327)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
* com.caucho.server.dispatch.ServletFilterChain.doFilter (ServletFilterChain.java:99) * com.caucho.server.webapp.WebAppFilterChain.doFilter (WebAppFilterChain.java:163) * com.caucho.server.dispatch.ServletInvocation.service (ServletInvocation.java:208) * com.caucho.server.http.HttpRequest.handleRequest (HttpRequest.java:259)
    * com.caucho.server.port.TcpConnection.run(TcpConnection.java:363)
    * com.caucho.util.ThreadPool.runTasks(ThreadPool.java:490)
    * com.caucho.util.ThreadPool.run(ThreadPool.java:423)
    * java.lang.Thread.run(Thread.java:613)

*/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to