-
struts2 tags problem
Hi all, a have a problem related to struts2 tags.
in my jsp page i have something like :
Code:
<s:property value="location.outboundPrefix" /><s:property value="phones[0].phNo" default=""/>
<s:if test="phones[0].phoneType == 1">
<s:url action="sms.html" id='smsUrl'>
<s:param name="pid" value="phones[0].id"></s:param>
</s:url>
<s:a href="%{smsUrl}"> SMS</s:a>
</s:if>
// and
<s:property value="location.outboundPrefix" /><s:property value="phones[1].phNo" default=""/>
<s:if test="phones[1].phoneType == 1">
<s:url action="sms.html" id='smsUrl'>
<s:param name="pid" value="phones[0].id"></s:param>
</s:url>
<s:a href="%{smsUrl}"> SMS</s:a>
</s:if>
the problem is that phones[1] does not exists in all cases, so when it is not set i got a IndexOutOfBounds exception.
How can i test if phones[1] exists in order to prevent this ?