如何从<html:select>标签中获取值?</html:select>

时间:2013-12-06 03:57:15

标签: java html jsp jsp-tags struts-1

这是我的标记:

<html:select property="customername" styleClass="select2" style="width:100% tabindex=-1" onclick="alert('hai')" styleId="customer_tree">
<logic:iterate name="namelist" id="namelistId" indexId="i">
<html:option value='${i+1}'><bean:write name="namelistId"/></html:option>
</logic:iterate>

我收到此错误:

  

javax.servlet.ServletException:javax.servlet.jsp.JspException:在任何范围内都找不到bean:“namelist”

这是我的Bean类:

private String customername;
private String imeino;
private String targetname;
private String simno;
private String duedate;
private String remark;
private String error;

public String getCustomername() {
    return customername;
}

public void setCustomername(String customername) {
    this.customername = customername;
}

public String getImeino() {
    return imeino;
}

public void setImeino(String imeino) {
    this.imeino = imeino;
}

public String getTargetname() {
    return targetname;
}

public void setTargetname(String tergetname) {
    this.targetname = tergetname;
}

public String getSimno() {
    return simno;
}

public void setSimno(String simno) {
    this.simno = simno;
}

public String getDuedate() {
    return duedate;
}

public void setDuedate(String duedate) {
    this.duedate = duedate;
}

public String getRemark() {
    return remark;
}

public void setRemark(String remark) {
    this.remark = remark;
}

public String getError() {
    return error;
}

public void setError(String error) {
    this.error = error;
}

当我使用普通标签而不使用标签时,我得到输出但使用上面的编码我得到了以上异常。我该怎么办?

这是我的动作类:

List<String> name_list = new ArrayList<String>();

        Query enc_password = session.createQuery("from account_dao");
        List list = enc_password.list();
        for (Iterator iterator = list.iterator(); iterator.hasNext();) {
            account_dao account = (account_dao) iterator.next();
            System.out.println("Id : " + account.getId());
            System.out.println("Account Name : " + account.getName());
            System.out.println("Account Password : " + account.getPassword());
            name_list.add(account.getName());
        }
        request.setAttribute("namelist", name_list);

        return mapping.findForward(SUCCESS);

0 个答案:

没有答案