Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java html:options集合-属性值没有可用的getter方法_Java_Jsp_Struts - Fatal编程技术网

Java html:options集合-属性值没有可用的getter方法

Java html:options集合-属性值没有可用的getter方法,java,jsp,struts,Java,Jsp,Struts,我需要创建一个下拉菜单,在这里我需要显示5个来自数据库的帐号。我计划做的是,将这5个帐号设置为一个数组列表,然后列表将保存在会话常量中。这个常量需要从我的JSP中获取 在我的动作课上- HttpSession session = request.getSession(); ArrayList accts = new ArrayList(); String acct1 = data.getAccountId1();

我需要创建一个下拉菜单,在这里我需要显示5个来自数据库的帐号。我计划做的是,将这5个帐号设置为一个数组列表,然后列表将保存在会话常量中。这个常量需要从我的JSP中获取

在我的动作课上-

            HttpSession session = request.getSession();

            ArrayList  accts = new ArrayList();
            String acct1 = data.getAccountId1();
            String acct2 = data.getAccountId2();
            accts.add(acct1);
            accts.add(acct2);
            session.setAttribute(
                    WorkConstants.TEST1,   
                    accts);
TEST1定义为公共字符串,如下所示: 公共字符串TEST1=“TEST1”

在我的jsp中,我这样编码

<td valign="top">
    1. accounts<span class="bodyCopy"><font color="#ff0000"> * </font></span>:
    <br/>
    <html:select name="MyDataForm" property="accountNumber" 
    styleClass="formContent">
        <html:options collection="<%= WorkConstants.TEST1 %>" 
        property="value" labelProperty="label" styleClass="formContent"/>
    </html:select>
    <br/>
</td>

1.账户*:


但这不起作用获取错误为-没有getter方法可用于名为Test1的bean的属性值。看起来我的数组值没有设置到TEST1中。
为什么?

用支柱的
LabelValueBean
包裹
acct1
acct2
,如下所示:-

ArrayList  accts = new ArrayList();

String acct1 = data.getAccountId1();
String acct2 = data.getAccountId2();

accts.add(new LabelValueBean(acct1, acct1));
accts.add(new LabelValueBean(acct2, acct2));

session.setAttribute(WorkConstants.TEST1,accts);