How to compare 2 numberic fields and validate using jsf
843844Sep 28 2007 — edited Sep 29 2007Hi,
I am newbie to jsf. I have 2 Double fields one is lower limit and other one upper limit.
I want to compare those 2 field values 'upper limit' should be greater than the 'lower limit'.
If upper limit entered is less than lower limit and when user clicks the submit button it should display error message in UI.
<code>
<tr>
<td width="30%" align="right"><b><h:outputText id="lLowerMileLimit" value="Lower Mile Limit" /></b><span style="color:red">*</span>
</td>
<td width="50%" align="left">: <h:inputText id="lowerMileLimit" value="#{awardZoneMast.lowerMileLimit}" required="true" >
<t:validateRegExpr pattern="((^\d{1,10}$)|(^\d{1,10}\.\d{0,6}$))" />
</h:inputText>
<h:message for="lowerMileLimit" showSummary="true" showDetail="false" style="color:red" />
</td>
</tr>
<tr>
<td width="30%" align="right"><b><h:outputText id="uUpperMileLimit" value="Upper Mile Limit" /></b><span style="color:red">*</span>
</td>
<td width="50%" align="left">: <h:inputText id="upperMileLimit" value="#{awardZoneMast.upperMileLimit}" required="true">
<t:validateRegExpr pattern="((^\d{1,10}$)|(^\d{1,10}\.\d{0,6}$))" />
</h:inputText>
<h:message for="upperMileLimit" showSummary="true" showDetail="false" style="color:red" />
</td>
</tr>
</code>
I want to do this using JSF.. How would i able to do this.
Help anyone help me.
Thanks,
Ambika☺