我看了一本叫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>
我只把有问题的代码手写下来(可能有点小错,不影响纠错)帮忙看看我哪理解错了啊
解决方案 »
- 请教两个问题,一个是URLConnection,一个是修改内存地址值
- 求个进制转换方法
- 怎么判断一个数与数组中的任意一个都不相等呀
- Jtable 中 list 上移/下移 问题
- 请问这段代码怎么错了?
- 鼠标单击与双击的区分
- 关于强制转换的问题
- 初学JB,那位兄弟给我说一下DATABASE,TABLEDATASET,QUERYDATASET的常用方法和属性,谢谢!
- 怎样得到select选择的多个值
- 问一下,JBulider5的Serial Number和Key是多少呀!谢谢!在线等待!在谢谢!
- 条形码问题???
- 根据起始IP地址和结束IP地址,计算子网掩码,有一种情况会出现死循环,找不到原因何在
楼主【sxy_1】截止到2008-07-21 15:57:43的历史汇总数据(不包括此帖):
发帖的总数量:69 发帖的总分数:1730 每贴平均分数:25
回帖的总数量:36 得分贴总数量:2 回帖的得分率:5%
结贴的总数量:43 结贴的总分数:1050
无满意结贴数:4 无满意结贴分:80
未结的帖子数:26 未结的总分数:680
结贴的百分比:62.32 % 结分的百分比:60.69 %
无满意结贴率:9.30 % 无满意结分率:7.62 %
楼主加油
我感觉应该是
<formset>
<form name="login">
<field property="Product" indexedListProperty="product" depends="required">
<arg position="0" key="prompt.aa"/>
</field>
</form>
</formset>
没试过这样验证数组,验证字符串应该可以.
把Form中属性改成String试下.