我看了一本叫java完全手册的,按照上面说的写了个属性索引的validation 验证的代码,但是报错:method product 没有 getter方法。为什么?
class helloform extends validatorform
{
private String[] product = {"aa","bb"};
public String getProduct(int index){
return product[index];
}
publuc String setProduct(int index,String value){
product[index] = value;
}
} ----------------------------------在validation.xml------------
<formset>
<form name="login">
<field property="aa" indexedListProperty="product" depends="required">
<arg position="0" key="prompt.aa"/>
</field>
</form>
</formset> ------------------------在index.jsp中----
<html:form action="/...">
<html:text property="product[0]"/>
</html:form>
我只把有问题的代码手写下来(可能有点小错,不影响纠错)帮忙看看我哪理解错了啊
class helloform extends validatorform
{
private String[] product = {"aa","bb"};
public String getProduct(int index){
return product[index];
}
publuc String setProduct(int index,String value){
product[index] = value;
}
} ----------------------------------在validation.xml------------
<formset>
<form name="login">
<field property="aa" indexedListProperty="product" depends="required">
<arg position="0" key="prompt.aa"/>
</field>
</form>
</formset> ------------------------在index.jsp中----
<html:form action="/...">
<html:text property="product[0]"/>
</html:form>
我只把有问题的代码手写下来(可能有点小错,不影响纠错)帮忙看看我哪理解错了啊
楼主【sxy_1】截止到2008-07-21 15:56:01的历史汇总数据(不包括此帖):
发帖的总数量:68 发帖的总分数:1710 每贴平均分数:25
回帖的总数量:36 得分贴总数量:2 回帖的得分率:5%
结贴的总数量:43 结贴的总分数:1050
无满意结贴数:4 无满意结贴分:80
未结的帖子数:25 未结的总分数:660
结贴的百分比:63.24 % 结分的百分比:61.40 %
无满意结贴率:9.30 % 无满意结分率:7.62 %
楼主加油
<html:form action="/...">
<html:text property="product[0]"/>
</html:form>
你这样写是不对的 要写也是这样子的
<html:form action="/...">
<html:text property="product"/>
</html:form>