I have data validation by JS. Now I want to write another set's data input validation by java, not java script - server-side validation. How can I do that?
Here are my input parameters
<form class="portlet-generic-con
tainer" style="clear:left;" name="NetFlow" action="<portlet:actionURL
/>" method="post" onSubmit="return ValidateForm()" >
<div class="portlet-generic-con
tainer" style="padding-top:5px;pad
ding-botto
m:5px; clear:left;" id="ICC">
<fieldset class="portlet-generic-con
tainer" style="padding-top:5px;pad
ding-botto
m:5px; clear:left;">
<legend class="portlet-generic-con
tainer" style="padding-top:5px;pad
ding-botto
m:5px; clear:left;">
<label class="portlet-form-label"
style="color:black; size:medium">Type</label>
</legend>
<input name="VolContID" type="hidden" value="999" >
<input name="radio_button" type="radio" value="imbalance" onclick="toggleBox('IC',1)
;" >
<label class="portlet-form-label"
style="color:black; size:medium">Imbalance</la
bel>
<input name="radio_button" type="radio" value="volume" checked onclick="toggleBox('IC',0)
;" >
<label class="portlet-form-label"
style="color:black; size:medium">Volume</label
>
<div style="padding-top:5px;pad
ding-botto
m:5px; visibility:hidden; clear:left;" id="IC">
<label class="portlet-form-label"
>Degree of Imbalance:</label>
<input name="DegImb" type="text" size="3" value="65" onkeyup="ValidateIntlNumbe
r(this);">
<label class="portlet-form-label"
>( enter as 50% )</label>
<label class="portlet-form-label"
>Min. Flows Per Hour:</label>
<input name="TotalFlowImb" type="text" size="3" value="10" onkeyup="ValidateIntlNumbe
r(this);" >
<label class="portlet-form-label"
>( enter as 5, 10, 20... )</label>
</div>
</fieldset>
</div>
<div class="portlet-generic-con
tainer" style="clear:left;padding-
top:5px;pa
dding-bott
om:5px;">
<label class="portlet-form-label"
>
# of Results: </label><input type="text" name="Num_Results" size="3" maxlength="3" value="10" onkeyup="ValidateIntlNumbe
r(this);" >
</div>
<div class="portlet-generic-con
tainer" style="clear:left; padding-top:5px;padding-bo
ttom:5px;"
>
<label class="portlet-form-label"
>Date Range:</label>
<input type="text" size="10" maxlength="20" name= "BegDate" value="<%=y%>">
<a href="javascript:showCal('
Calendar1'
)">
<img src="images/cal.jpg" alt="start date calendar icon" width="34" height="21" border="0"></a> -
<input type="text" size="10" maxlength="20" name="EndDate" value=<%=s%> >
<a href="javascript:showCal('
Calendar2'
)">
<img src="images/cal.jpg" alt="end date calendar icon" width="34" height="21" border="0"></a>
<label class="portlet-generic-con
tainer" style="padding-top:5px;pad
ding-botto
m:5px; clear:left;" >
<label class="portlet-form-label"
>( enter as mm/dd/yyyy)</label>
</div>
<%
Calendar cal2 =Calendar.getInstance();
Integer hr = new Integer( cal2.get(Calendar.HOUR_OF_
DAY));
Integer min = new Integer(( cal2.get(Calendar.MINUTE))
);
String MyNow = hr.toString()+":"+min.toSt
ring();
%>
<div class="portlet-generic-con
tainer" style="clear:left;padding-
top:5px;pa
dding-bott
om:5px;">
<label class="portlet-form-label"
style="color:black; size:medium">Time Period: </label>
<select name="begtime"><option><%=
MyNow%></o
ption><opt
ion>01:00<
/option><o
ption>02:0
0</option>
<option>03
:00</optio
n><option>
04:00</opt
ion><optio
n>05:00</o
ption><opt
ion>06:00<
/option><o
ption>07:0
0</option>
<option>08
:00</optio
n><option>
09:00</opt
ion><optio
n>10:00</o
ption><opt
ion>11:00<
/option><o
ption>12:0
0</option>
<option>13
:00</optio
n><option>
14:00</opt
ion><optio
n>15:00</o
ption><opt
ion>16:00<
/option><o
ption>17:0
0</option>
<option>18
:00</optio
n><option>
19:00</opt
ion><optio
n>20:00</o
ption><opt
ion>21:00<
/option><o
ption>22:0
0</option>
<option>23
:00</optio
n><option>
24:00</opt
ion></sele
ct>
- <select name="endtime"><option><%=
MyNow%></o
ption><opt
ion>01:00<
/option><o
ption>02:0
0</option>
<option>03
:00</optio
n><option>
04:00</opt
ion><optio
n>05:00</o
ption><opt
ion>06:00<
/option><o
ption>07:0
0</option>
<option>08
:00</optio
n><option>
09:00</opt
ion><optio
n>10:00</o
ption><opt
ion>11:00<
/option><o
ption>12:0
0</option>
<option>13
:00</optio
n><option>
14:00</opt
ion><optio
n>15:00</o
ption><opt
ion>16:00<
/option><o
ption>17:0
0</option>
<option>18
:00</optio
n><option>
19:00</opt
ion><optio
n>20:00</o
ption><opt
ion>21:00<
/option><o
ption>22:0
0</option>
<option>23
:00</optio
n><option>
24:00</opt
ion></sele
ct>
</div>
<div class="portlet-generic-con
tainer" style="clear:left;padding-
top:5px;pa
dding-bott
om:5px;">
<label class="portlet-form-label"
>My Networks: </label>
<select multiple id="networks" name="networks" type="text" class="portlet-form-input-
field" >
</select>
</div>
<div class="portlet-document-fo
oter-conta
iner" style="text-align:left;">
<input class="portlet-form-button
" style="size:larger" type='submit' value="Adv.Fetch Results" name="Adv_Fetch_Results">
<input class="portlet-form-button
" style="size:larger" type="submit" value="Goto Simple Search" name="Goto_Sim_Search">
</div>
</form>
Here are the inputs I need to do server-side validation in java
1. Degree of Imbalance:<input name="DegImb" type="text">, must be an integer value
2. Min. Flows Per Hour: <input name="TotalFlowImb" type="text">, must be an integer value
3. # of Results: <input type="text" name="Num_Results">, must be an integer value
4. Begin Date <input type="text" size="10" maxlength="20" name= "BegDate"> must be a date value
5. End Date <input type="text" size="10" maxlength="20" name="EndDate" > must be a date value
6. begtime <select name="begtime">, must be time value
7. <select name="endtime">, must be a time value
I want to do validation above by java. in the code, if not the value, throw out an exception. I want to do the
try....
cath....
Can anyone give me sample code about above?
Thanks