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 JSTL html选择和选项:在名称下找不到bean_Java_Jsp_Jstl_Javabeans - Fatal编程技术网

Java JSTL html选择和选项:在名称下找不到bean

Java JSTL html选择和选项:在名称下找不到bean,java,jsp,jstl,javabeans,Java,Jsp,Jstl,Javabeans,我收集了以下对象: public class MyForm { private List<Selection> selections = new ArrayList<Selection>(); ... getters / setters ... } public class Selection { private Option option; private List<Option> options = new ArrayL

我收集了以下对象:

public class MyForm
{
    private List<Selection> selections = new ArrayList<Selection>();

    ... getters / setters ...
}

public class Selection
{
    private Option option;
    private List<Option> options = new ArrayList<Option>();

    ... getters /setters ...
}

public class Option
{
    private Integer id;      
    private Integer aValue;
    private Integer anotherValue;
    private Integer choiceIdentifier;

    ... getters /setters ...
}
抱歉问了这么多问题

编辑:使用选项bean更新
编辑:使用表单bean更新,表单bean是jsp的bean

因此JSP页面中的所有html标记
属性
都应该是您的表单

<html:select name="selection" property="option"

我认为问题在于property=“option”。您能为该JSP文件添加form bean类吗?@SivaKumar K,已更新。pl能为该JSP文件添加form bean类吗stackoverflow@SivaKumar哦,是的,完成了。Thanks@Lurk21但这是不同的。属性是字段,用于在提交表单后从表单中检索值。但是选项是表单请求值。属性在提交表单后使用。它应该在你的表格中定义。我明白了。但我会有很多这样的选择框。每个选项的一个选项。这听起来有点倒退,但它是正确的。表单有一个选择数组。如何存储每个选择的选项?@21在form类中将所有选择框属性名作为单独的字段提供给您。嗯?我不明白。另外,我尝试了以下方法:property=“${cropSelection.election}”,得到了“无效的索引属性”
javax.servlet.jsp.JspException: Cannot find bean under name [Option[id=null, aValue=5678, anotherValue=1234, choiceIdentifier=1212]]
<html:select name="selection" property="option"