开发者

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

开发者 https://www.devze.com 2023-01-31 11:12 出处:网络
I have a situation where a list of JobTitles can have 0 length, and if it does, thefield jobTitleId should not be validated.

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

精彩评论

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