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.
精彩评论