Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to compare 2 numberic fields and validate using jsf

843844Sep 28 2007 — edited Sep 29 2007
Hi,

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&#9786;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2007
Added on Sep 28 2007
8 comments
981 views