[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

how to do data validation by java, not java script

Asked by wasabi3689 in Java Programming Language, Java Server Pages (JSP), J2EE

Tags: java, validation, data

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-container"  style="clear:left;" name="NetFlow" action="<portlet:actionURL/>" method="post" onSubmit="return ValidateForm()" >
                   
                        <div class="portlet-generic-container" style="padding-top:5px;padding-bottom:5px; clear:left;" id="ICC">
                         
                                <fieldset class="portlet-generic-container" style="padding-top:5px;padding-bottom:5px; clear:left;">
                                <legend class="portlet-generic-container" style="padding-top:5px;padding-bottom: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</label>                              
                                <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;padding-bottom: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="ValidateIntlNumber(this);">
                                <label class="portlet-form-label">( enter as 50% )</label>&nbsp; &nbsp;
                                <label class="portlet-form-label">Min. Flows Per Hour:</label>
                                <input name="TotalFlowImb" type="text" size="3" value="10" onkeyup="ValidateIntlNumber(this);" >
                                <label class="portlet-form-label">( enter as 5, 10, 20... )</label>
                           
                </div>
            </fieldset>
           </div>
           
        <div class="portlet-generic-container" style="clear:left;padding-top:5px;padding-bottom:5px;">
            <label class="portlet-form-label">
            # of Results: </label><input type="text" name="Num_Results" size="3" maxlength="3" value="10" onkeyup="ValidateIntlNumber(this);" >
        </div>
       
        <div class="portlet-generic-container" style="clear:left; padding-top:5px;padding-bottom: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-container" style="padding-top:5px;padding-bottom: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.toString();          
                 %>
       
        <div class="portlet-generic-container" style="clear:left;padding-top:5px;padding-bottom:5px;">
            <label class="portlet-form-label" style="color:black; size:medium">Time Period: </label>
                <select name="begtime"><option><%=MyNow%></option><option>01:00</option><option>02:00</option><option>03:00</option><option>04:00</option><option>05:00</option><option>06:00</option><option>07:00</option><option>08:00</option><option>09:00</option><option>10:00</option><option>11:00</option><option>12:00</option><option>13:00</option><option>14:00</option><option>15:00</option><option>16:00</option><option>17:00</option><option>18:00</option><option>19:00</option><option>20:00</option><option>21:00</option><option>22:00</option><option>23:00</option><option>24:00</option></select>
            - <select name="endtime"><option><%=MyNow%></option><option>01:00</option><option>02:00</option><option>03:00</option><option>04:00</option><option>05:00</option><option>06:00</option><option>07:00</option><option>08:00</option><option>09:00</option><option>10:00</option><option>11:00</option><option>12:00</option><option>13:00</option><option>14:00</option><option>15:00</option><option>16:00</option><option>17:00</option><option>18:00</option><option>19:00</option><option>20:00</option><option>21:00</option><option>22:00</option><option>23:00</option><option>24:00</option></select>
           
        </div>
        <div class="portlet-generic-container" style="clear:left;padding-top:5px;padding-bottom: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-footer-container" 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
[+][-]12/06/07 09:45 AM, ID: 20421519Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Java Programming Language, Java Server Pages (JSP), J2EE
Tags: java, validation, data
Sign Up Now!
Solution Provided By: Kuldeepchaturvedi
Participating Experts: 2
Solution Grade: A
 
[+][-]12/06/07 09:58 AM, ID: 20421620Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]12/11/07 08:25 AM, ID: 20450347Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/11/07 09:25 AM, ID: 20450857Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/28/08 01:14 PM, ID: 22339337Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09/01/08 10:32 AM, ID: 22361692Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 / EE_QW_2_20070628