forms - 支柱 1 : Put values of a jsp into form that uses a java List

标签 forms jsp struts struts-1

在我的jsp中,我有一些这样的字段:

<html:text property="field[0]" value="${fieldValue}" indexed="true">
<html:text property="field[1]" value="${fieldValue}" indexed="true">
<html:text property="field[2]" value="${fieldValue}" indexed="true">
<html:text property="field[3]" value="${fieldValue}" indexed="true">

在我的表单中,我有一个 java.util.list,我需要从顶部的字段中填充它:
private List<Double> field = new ArrayList<Double>();

public final List<Double> getField() {
    return field;
}
public final void setField(final List<Double> valeur) {
    this.field = valeur;
}

问题是该列表未填充。
有任何想法吗 ???
谢谢 !!

最佳答案

据我所知,
1、如果是struts 1,美元“$”字段取值不起作用。
2. 你不应该在属性名称中指定索引,但它会被标签翻译器自动使用,因此你的代码看起来像

 <html:text property="field" indexed="true"> 
 <html:text property="field" indexed="true">
 <html:text property="field" indexed="true">
 <html:text property="field" indexed="true">  

我希望这可以帮助您解决您的问题。

关于forms - 支柱 1 : Put values of a jsp into form that uses a java List,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8384644/

相关文章:

php - 在表单中使用名称 ="something[]"

java - 多选项卡问题 对于 Java Web 应用程序之一 - 混合来自两个不同记录的数据

ruby-on-rails - Rails 表单不断返回 nomethoderror

ruby-on-rails - Rails 复选框和序列化数据

java - 如何从直接从另一个 jsp 检索值的 jsp 向 servlet 发送值

java - 如何测试 <c :if> jSTL 中的多个条件

java - Struts 2框架演示

java - Websphere 自定义错误页面不工作

java - Action 类是否具有像formbean这样的范围

forms - History.pushstate 和 HTTP POST 表单转发