I wish to write out some values of a Hashtable using the nested tags.

I have read the documentation and know I have to refer to either the key or
the value property to access the underlying data but get the following
message when accessing the JSP/Form bean combination detailed below.

Error 500: No getter method for property x(5).key of bean formBean

This suggests to me it has a problem with the last element or has gone
outside of the Hashtable size?

I would really appreciate your help, my Collection and simple property tests
work fine but really need to get Hashtable working.

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<html:form action="/submit.do" method="post">
        <nested:iterate property="x">
                Key: <nested:write property="key" />
       <nested:nest property="value">
                        Value: <nested:write property="stuff" /><br />
                </nested:nest>
        </nested:iterate>
</html:form>

public class SubmitForm extends ActionForm {

        private Hashtable x = new Hashtable();

        public SubmitForm() {

                x.put("1", new MyTest());
                x.put("2", new MyTest());
                x.put("3", new MyTest());
                x.put("4", new MyTest());
       x.put("5", new MyTest());
        }
        public Hashtable getX() {
                return x;
        }
        public void setX(Hashtable hashtable) {
                x = hashtable;
        }
}

public class MyTest {

        private String stuff = "stuffing";
        public String getStuff() {
                return stuff;
        }
        public void setStuff(String string) {
                stuff = string;
        }
}

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


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

Reply via email to