开发者

Struts 1.1 validation.xml: myList.size() == 0. How to check for this

I have a situation where a list of JobTitles can have 0 length, and if it does, the field jobTitleId should not be validated.

<field property="jobTitleId" depends="validwhen">
    <msg name="required" key="errors.required" />
    <arg position="0" key="fld.job.title" />
    <var>
        <var-name&g开发者_如何学Pythont;test</var-name>
        <var-value>((jobTitles.size() == 0) or (*this* != null))</var-value>
    </var>
</field>

Any help would certainly be appreciated. I've tried the developer docs and I'm just not getting it.


Apparently the .size() was causing the trouble, so I changed the code so that jobTitles would be null in that case and it worked.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜