Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions need help to remove and optimise the code for creating a page

Have Programming Question? Ask it here!
 
 
 


Rashpal Singh Johar
need help to remove and optimise the code for creating a page
0 Answer(s)      a year and 6 months ago
Posted in : JavaScript Questions


i have the following code but it has some sorts of error whenever i run the page after validation through javascript it calls for the servlets and then i tried to retrive the parameters but it is always showing me null values. My Html page is like this

<form action="sfkcreateaccount" method="post">
                <table style="width: 940px">
                    <tr>
                        <td style="width: 450px; margin: 5px; padding: 5px">
                            <div>
                                <table>
                                    <tr>
                                        <td>
                                            First Name:
                                        </td>
                                        <td>
                                            <input type="text" id="fname" placeholder="First Name" style="width: 157px" maxlength="2048">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Last Name:
                                        </td>
                                        <td>
                                            <input type="text" id="lname" placeholder="Last Name" style="width: 157px" maxlength="2048">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Choose Password:
                                        </td>
                                        <td>
                                            <input type="password" id="pwd1" placeholder="Choose Password" style="width: 157px" maxlength="40">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Choose Username:
                                        </td>
                                        <td>
                                            <input type="text" id="uname1" placeholder="Choose Username" style="text-transform: lowercase; width: 157px;" maxlength="100">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Gender:
                                        </td>
                                        <td>
                                            <input type="radio" name="gender" value="Male" checked="checked" id="male"><label for="male">Male</label>
                                            <input type="radio" name="gender" value="Female" id="female"><label for="female">Female</label>
                                        </td>
                                    </tr>                                        
                                </table>
                            </div>
                        </td>
                        <td style="width: 450px; margin: 5px;padding: 5px">
                            <div>
                                <table>
                                    <tr>
                                        <td>
                                            Middle Name:
                                        </td>
                                        <td>
                                            <input type="text" id="mname" placeholder="Middle Name" style="width: 157px" maxlength="2048">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Date of Birth:
                                        </td>
                                        <td>
                                            <input type="date" id="dob" placeholder="MM/DD/YYYY" style="width: 157px">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Verify Password:
                                        </td>
                                        <td>
                                            <input type="password" id="pwd2" placeholder="Verify Password" style="width: 157px" maxlength="40">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Verify Username:
                                        </td>
                                        <td>
                                            <input type="text" id="uname2" placeholder="Verify Username" style="text-transform: lowercase; width: 157px" maxlength="100">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Country:
                                        </td>
                                        <td>
                                            <select style="width: 157px" id="cntri">
                                                <option value="-1">Select Your Country</option>
                                                <option value="AF">Afghanistan</option> 
                                                <option value="AX">√?‚?¶land Islands </option>
                                                <option value="AL">Albania </option>
                                                <option value="DZ">Algeria </option>
                                                <option value="AS">American Samoa </option>
                                                <option value="AD">AndorrA </option>
                                                <option value="AO">Angola </option>
                                                <option value="AI">Anguilla </option>
                                                <option value="AQ">Antarctica </option>
                                                <option value="AG">Antigua and Barbuda</option> 
                                                <option value="AR">Argentina </option>
                                                <option value="AM">Armenia </option>
                                                <option value="AW">Aruba </option>
                                                <option value="AU">Australia</option> 
                                                <option value="AT">Austria </option> 
                                                <option value="AZ">Azerbaijan </option>
                                                <option value="BS">Bahamas</option>
                                                <option value="BH">Bahrain </option>
                                                <option value="BD">Bangladesh </option>
                                                <option value="BB">Barbados </option>
                                                <option value="BY">Belarus </option>
                                                <option value="BE">Belgium </option>
                                                <option value="BZ">Belize </option>
                                                <option value="BJ">Benin</option>
                                                <option value="BM">Bermuda</option>
                                                <option value="BT">Bhutan</option>
                                                <option value="BO">Bolivia</option>
                                                <option value="BA">Bosnia and Herzegovina</option>
                                                <option value="BW">Botswana</option>
                                                <option value="BV">Bouvet Island</option>
                                                <option value="BR">Brazil</option>
                                                <option value="IO">British Indian Ocean Territory</option>
                                                <option value="BN">Brunei Darussalam</option>
                                                <option value="BG">Bulgaria</option>
                                                <option value="BF">Burkina Faso</option>
                                                <option value="BI">Burundi</option>  
                                                <option value="KH">Cambodia </option>
                                                <option value="CM">Cameroon </option>
                                                <option value="CA">Canada </option>
                                                <option value="CV">Cape Verde </option>
                                                <option value="KY">Cayman Islands </option>
                                                <option value="CF">Central African Republic</option>
                                                <option value="TD">Chad </option>
                                                <option value="CL">Chile </option>
                                                <option value="CN">China </option>
                                                <option value="CX">Christmas Island </option>
                                                <option value="CC">Cocos (Keeling) Islands </option>
                                                <option value="CO">Colombia </option>
                                                <option value="KM">Comoros </option>
                                                <option value="CG">Congo </option>
                                                <option value="CD">Congo, The Democratic Republic of the </option>
                                                <option value="CK">Cook Islands </option>
                                                <option value="CR">Costa Rica </option>
                                                <option value="CI">Cote D'Ivoire </option>
                                                <option value="HR">Croatia </option>
                                                <option value="CU">Cuba </option>
                                                <option value="CY">Cyprus </option>
                                                <option value="CZ">Czech Republic </option>                                                    
                                                <option value="DK">Denmark</option>  
                                                <option value="DJ">Djibouti</option> 
                                                <option value="DM">Dominica</option> 
                                                <option value="DO">Dominican Republic</option> 
                                                <option value="EC">Ecuador</option> 
                                                <option value="EG">Egypt</option> 
                                                <option value="SV">El Salvador</option> 
                                                <option value="GQ">Equatorial Guinea</option> 
                                                <option value="ER">Eritrea</option> 
                                                <option value="EE">Estonia</option> 
                                                <option value="ET">Ethiopia</option> 
                                                <option value="FK">Falkland Islands (Malvinas)</option> 
                                                <option value="FO">Faroe Islands</option> 
                                                <option value="FJ">Fiji</option> 
                                                <option value="FI">Finland</option> 
                                                <option value="FR">France</option> 
                                                <option value="GF">French Guiana</option> 
                                                <option value="PF">French Polynesia</option> 
                                                <option value="TF">French Southern Territories</option> 
                                                <option value="GA">Gabon</option> 
                                                <option value="GM">Gambia</option> 
                                                <option value="GE">Georgia</option> 
                                                <option value="DE">Germany</option> 
                                                <option value="GH">Ghana</option> 
                                                <option value="GI">Gibraltar</option> 
                                                <option value="GR">Greece</option> 
                                                <option value="GL">Greenland</option> 
                                                <option value="GD">Grenada</option> 
                                                <option value="GP">Guadeloupe</option> 
                                                <option value="GU">Guam</option> 
                                                <option value="GT">Guatemala</option> 
                                                <option value="GG">Guernsey</option> 
                                                <option value="GN">Guinea</option> 
                                                <option value="GW">Guinea-Bissau</option> 
                                                <option value="GY">Guyana</option> 
                                                <option value="HT">Haiti</option> 
                                                <option value="HM">Heard Island and Mcdonald Islands</option> 
                                                <option value="VA">Holy See (Vatican City State)</option> 
                                                <option value="HN">Honduras</option> 
                                                <option value="HK">Hong Kong</option> 
                                                <option value="HU">Hungary</option> 
                                                <option value="IS">Iceland</option> 
                                                <option value="IN">India</option> 
                                                <option value="ID">Indonesia</option> 
                                                <option value="IR">Iran, Islamic Republic Of</option> 
                                                <option value="IQ">Iraq</option> 
                                                <option value="IE">Ireland</option> 
                                                <option value="IM">Isle of Man</option> 
                                                <option value="IL">Israel</option> 
                                                <option value="IT">Italy</option> 
                                                <option value="JM">Jamaica</option> 
                                                <option value="JP">Japan</option> 
                                                <option value="JE">Jersey</option> 
                                                <option value="JO">Jordan</option> 
                                                <option value="KZ">Kazakhstan</option> 
                                                <option value="KE">Kenya</option> 
                                                <option value="KI">Kiribati</option> 
                                                <option value="KP">Korea, Democratic People'S Republic of</option> 
                                                <option value="KR">Korea, Republic of</option> 
                                                <option value="KW">Kuwait</option> 
                                                <option value="KG">Kyrgyzstan</option> 
                                                <option value="LA">Lao People'S Democratic Republic</option> 
                                                <option value="LV">Latvia</option> 
                                                <option value="LB">Lebanon</option> 
                                                <option value="LS">Lesotho</option> 
                                                <option value="LR">Liberia</option> 
                                                <option value="LY">Libyan Arab Jamahiriya</option> 
                                                <option value="LI">Liechtenstein</option> 
                                                <option value="LT">Lithuania</option> 
                                                <option value="LU">Luxembourg</option> 
                                                <option value="MO">Macao</option> 
                                                <option value="MK">Macedonia, The Former Yugoslav Republic of</option> 
                                                <option value="MG">Madagascar</option> 
                                                <option value="MW">Malawi</option> 
                                                <option value="MY">Malaysia</option> 
                                                <option value="MV">Maldives</option> 
                                                <option value="ML">Mali</option> 
                                                <option value="MT">Malta</option> 
                                                <option value="MH">Marshall Islands</option> 
                                                <option value="MQ">Martinique</option> 
                                                <option value="MR">Mauritania</option>     
                                                <option value="MU">Mauritius</option> 
                                                <option value="YT">Mayotte</option> 
                                                <option value="MX">Mexico</option> 
                                                <option value="FM">Micronesia, Federated States of</option> 
                                                <option value="MD">Moldova, Republic of</option> 
                                                <option value="MC">Monaco</option> 
                                                <option value="MN">Mongolia</option> 
                                                <option value="MS">Montserrat</option> 
                                                <option value="MA">Morocco</option> 
                                                <option value="MZ">Mozambique</option> 
                                                <option value="MM">Myanmar</option> 
                                                <option value="NA">Namibia</option> 
                                                <option value="NR">Nauru</option> 
                                                <option value="NP">Nepal</option> 
                                                <option value="NL">Netherlands</option> 
                                                <option value="AN">Netherlands Antilles</option> 
                                                <option value="NC">New Caledonia</option> 
                                                <option value="NZ">New Zealand</option> 
                                                <option value="NI">Nicaragua</option> 
                                                <option value="NE">Niger</option> 
                                                <option value="NG">Nigeria</option> 
                                                <option value="NU">Niue</option> 
                                                <option value="NF">Norfolk Island</option> 
                                                <option value="MP">Northern Mariana Islands</option> 
                                                <option value="NO">Norway</option> 
                                                <option value="OM">Oman</option> 
                                                <option value="PK">Pakistan</option> 
                                                <option value="PW">Palau</option> 
                                                <option value="PS">Palestinian Territory, Occupied</option> 
                                                <option value="PA">Panama</option> 
                                                <option value="PG">Papua New Guinea</option> 
                                                <option value="PY">Paraguay</option> 
                                                <option value="PE">Peru</option> 
                                                <option value="PH">Philippines</option> 
                                                <option value="PN">Pitcairn</option> 
                                                <option value="PL">Poland</option> 
                                                <option value="PT">Portugal</option> 
                                                <option value="PR">Puerto Rico</option> 
                                                <option value="QA">Qatar</option> 
                                                <option value="RE">Reunion</option> 
                                                <option value="RO">Romania</option> 
                                                <option value="RU">Russian Federation</option> 
                                                <option value="RW">RWANDA</option> 
                                                <option value="SH">Saint Helena</option> 
                                                <option value="KN">Saint Kitts and Nevis</option> 
                                                <option value="LC">Saint Lucia</option> 
                                                <option value="PM">Saint Pierre and Miquelon</option> 
                                                <option value="VC">Saint Vincent and the Grenadines</option> 
                                                <option value="WS">Samoa</option> 
                                                <option value="SM">San Marino</option>     
                                                <option value="ST">Sao Tome and Principe</option> 
                                                <option value="SA">Saudi Arabia</option>   
                                                <option value="SN">Senegal </option> 
                                                <option value="CS">Serbia and Montenegro</option> 
                                                <option value="SC">Seychelles</option> 
                                                <option value="SL">Sierra Leone</option> 
                                                <option value="SG">Singapore</option> 
                                                <option value="SK">Slovakia</option> 
                                                <option value="SI">Slovenia</option> 
                                                <option value="SB">Solomon Islands</option> 
                                                <option value="SO">Somalia</option> 
                                                <option value="ZA">South Africa</option> 
                                                <option value="GS">South Georgia and the South Sandwich Islands</option> 
                                                <option value="ES">Spain</option> 
                                                <option value="LK">Sri Lanka</option> 
                                                <option value="SD">Sudan</option> 
                                                <option value="SR">Suriname</option> 
                                                <option value="SJ">Svalbard and Jan Mayen</option> 
                                                <option value="SZ">Swaziland</option> 
                                                <option value="SE">Sweden</option> 
                                                <option value="CH">Switzerland</option> 
                                                <option value="SY">Syrian Arab Republic</option> 
                                                <option value="TW">Taiwan, Province of China</option> 
                                                <option value="TJ">Tajikistan</option> 
                                                <option value="TZ">Tanzania, United Republic of</option> 
                                                <option value="TH">Thailand</option> 
                                                <option value="TL">Timor-Leste</option> 
                                                <option value="TG">Togo</option> 
                                                <option value="TK">Tokelau</option> 
                                                <option value="TO">Tonga</option> 
                                                <option value="TT">Trinidad and Tobago</option> 
                                                <option value="TN">Tunisia</option> 
                                                <option value="TR">Turkey</option> 
                                                <option value="TM">Turkmenistan</option> 
                                                <option value="TC">Turks and Caicos Islands</option> 
                                                <option value="TV">Tuvalu</option> 
                                                <option value="UG">Uganda</option> 
                                                <option value="UA">Ukraine</option> 
                                                <option value="AE">United Arab Emirates</option> 
                                                <option value="GB">United Kingdom</option> 
                                                <option value="US">United States</option> 
                                                <option value="UM">United States Minor Outlying Islands</option> 
                                                <option value="UY">Uruguay</option> 
                                                <option value="UZ">Uzbekistan</option> 
                                                <option value="VU">Vanuatu</option>
                                                <option value="VE">Venezuela</option> 
                                                <option value="VN">Viet Nam</option>  
                                                <option value="VG">Virgin Islands, British</option>
                                                <option value="VT">Virgin Islands, U.S.</option>
                                                <option value="WF">Wallis and Futuna</option>
                                                <option value="EH">Western Sahara</option>
                                                <option value="YE">Yemen</option>
                                                <option value="ZM">Zambia</option>
                                                <option value="ZW">Zimbabwe</option>
                                            </select>
                                        </td>
                                    </tr>
                                </table>                        
                            </div>
                        </td>
                    </tr>
                </table>
                <div style="text-align: center;padding-top: 20px">

                        <input id="Create_Account_Control" type="submit" value="Create My New Account" style="border-width: 2px; border-radius: 6px; border-color: threeddarkshadow; background-color: snow; width: 180px; height: 25px;" onmousedown="musdown()" onmouseout="musout()" onmouseover="musover()" onmouseup="musup()" onkeypress="musdown()">

                </div>
                     </form>

After This i added Java Scripts by following

function musup()
{
    document.getElementById('Create_Account_Control').style.backgroundColor='#6f6';
    document.getElementById("Create_Account_Control").style.borderColor='threedshadow';
    document.getElementById("Create_Account_Control").style.fontStyle='italic';
    document.getElementById("Create_Account_Control").style.fontWeight='bold';
}
function musdown()
{
    document.getElementById('Create_Account_Control').style.backgroundColor='lightblue';
    document.getElementById("Create_Account_Control").style.borderColor='threedshadow';
    document.getElementById("Create_Account_Control").style.fontStyle='oblique';
    document.getElementById("Create_Account_Control").style.fontWeight='bold';
    click_action();
}
function musover()
{            
    document.getElementById('Create_Account_Control').style.backgroundColor='#6f6';
    document.getElementById("Create_Account_Control").style.borderColor='threedshadow';
    document.getElementById("Create_Account_Control").style.fontStyle='italic';
    document.getElementById("Create_Account_Control").style.fontWeight='bold';
}
function musout()
{
    document.getElementById('Create_Account_Control').style.backgroundColor='snow';
    document.getElementById("Create_Account_Control").style.borderColor='threeddarkshadow';
    document.getElementById("Create_Account_Control").style.fontStyle='normal';
    document.getElementById("Create_Account_Control").style.fontWeight='normal';
}
function click_action()
{
    var fname,mname,lname,pwd1,pwd2,uname1,uname2,gender,cntri,t,dob_year,dob_month,dob_date,current_year,current_month,current_date,temp,dob,current;
    t=new Date();
    fname=document.getElementById("fname").value;
    mname=document.getElementById("mname").value;
    lname=document.getElementById("lname").value;
    t=document.getElementById("dob").value;
    pwd1=document.getElementById("pwd1").value;
    pwd2=document.getElementById("pwd2").value;
    uname1=document.getElementById("uname1").value;
    uname2=document.getElementById("uname2").value;
    cntri=document.getElementById("cntri").value;
    temp=document.getElementsByName("gender");

    dob=new Date(t);
    current=new Date();

    dob_year=dob.getFullYear();
    dob_month=dob.getMonth();
    dob_date=dob.getDate();
    current_year=current.getFullYear();
    current_month=current.getMonth();
    current_date=current.getDate();

    if(fname.length<=0||mname.length<=0||lname.lenght<=0||pwd1.lenght<=0||pwd2.length<=0||uname1.length<=0||uname2.lenght<=0||cntri==-1)
    {
        alert("Please Fill All the Fields First");
    }
    else
    {
        if(t==null)
        {
            alert("Please Select your Birth Date")
        }
        else
        {
            if(current_year>=dob_year)
            {
                if(current_month>=dob_month)
                {
                    if(current_date>dob_date)
                    {
                        if(temp[0].checked == true || temp[1].checked == true )
                        { 
                            if(temp[0].checked==true)
                            {
                                gender=temp[0].value;
                            }
                            if(temp[1].checked==true)
                            {
                                gender=temp[1].value;
                            }
                           validity();
                        }    
                        else
                        {
                            alert("Please Select a Gender");
                        }
                    }
                    else
                    {
                        alert("Invalid Date");
                    }
                }
                else
                {
                    alert("Invalid month");
                }
            }
            else
            {
                alert("Invalid Year");
            }
        }
    }
}
function validity()
{
    var pwd1,pwd2,uname1,uname2;

    pwd1=document.getElementById("pwd1").value;
    pwd2=document.getElementById("pwd2").value;
    uname1=document.getElementById("uname1").value;
    uname2=document.getElementById("uname2").value;
    uname1.toString().toLowerCase();
    uname2.toString().toLowerCase();
        if(pwd1==pwd2)
        {
            if(uname1==uname2)
            {
                Name_validaton();
            }
            else
            {
                alert("Usernames didn't matches");
            }
        }
        else
        {
            alert("Passwords didn't matches");
        }
}
function Name_validaton()
{
    var fname,mname,lname;
    fname=document.getElementById("fname").value;
    mname=document.getElementById("mname").value;
    lname=document.getElementById("lname").value;

    f=String(fname);
    m=String(mname);
    l=String(lname);
    A0=String("?");
    A1=String("|");
    A2=String("\\");
    A3=String("[");
    A4=String("+");
    A5=String(")");
    A6=String("(");
    A7=String("*");
    A8=String("&");
    A9=String("^");
    B0=String("$");
    B1=String("$");
    B2=String("$");
    if(f.match("@")||m.match("@")||l.match("@")||f.match("!")||m.match("!")||l.match("!")||f.match("~")||m.match("~")||l.match("~")||f.match("`")||m.match("`")||l.match("`")||f.match("%")||m.match("%")||l.match("%")||f.match("#")||m.match("#")||l.match("#")||f.match("_")||m.match("_")||l.match("_")||f.match("=")||m.match("=")||l.match("=")||f.match("}")||m.match("}")||l.match("}")||f.match("{")||m.match("{")||l.match("{")||f.match("]")||m.match("]")||l.match("]")||f.match("\"")||m.match("\"")||l.match("\"")||f.match("'")||m.match("'")||l.match("'")||f.match(";")||m.match(";")||l.match(";")||f.match(":")||m.match(":")||l.match(":")||f.match(",")||m.match(",")||l.match(",")||f.match("<")||m.match("<")||l.match("<")||f.match(">")||m.match(">")||l.match(">")||f.match("/")||m.match("/")||l.match("/")||f.match("0")||f.match("1")||f.match("2")||f.match("3")||f.match("4")||f.match("5")||f.match("6")||f.match("7")||f.match("8")||f.match("9")||m.match("0")||m.match("1")||m.match("2")||m.match("3")||m.match("4")||m.match("5")||m.match("6")||m.match("7")||m.match("8")||m.match("9")||l.match("0")||l.match("1")||l.match("2")||l.match("3")||l.match("4")||l.match("5")||l.match("6")||l.match("7")||l.match("8")||l.match("9"))
    {
        alert("Invalid Character in Name");
        /*if(f.match(B0)||m.match(B0)||l.match(B0)||f.match(B1)||m.match(B1)||l.match(B1)||f.match(B2)||m.match(B2)||l.match(B2)||f.match(A0)||m.match(A0)||l.match(A0)||f.match(A1)||m.match(A1)||l.match(A1)||f.match(A2)||m.match(A2)||l.match(A2)||f.match(A3)||m.match(A3)||l.match(A3)||f.match(A4)||m.match(A4)||l.match(A4)||f.match(A5)||m.match(A5)||l.match(A5)||f.match(A6)||m.match(A6)||l.match(A6)||f.match(A7)||m.match(A7)||l.match(A7)||f.match(A8)||m.match(A8)||l.match(A8)||f.match(A9)||m.match(A9)||l.match(A9))
        {
        }*/
    }
    else
    {
        custname_validation();
    }
}
function custname_validation()
{
    var pwd1,pwd2,uname1,uname2;
    pwd1=document.getElementById("pwd1").value;
    pwd2=document.getElementById("pwd2").value;
    uname1=document.getElementById("uname1").value;
    uname2=document.getElementById("uname2").value;
    u1=String(uname1);
    u2=String(uname2);
    if(pwd1.length<=7||pwd2.length<=7)
    {
        alert("Password Must be between 8 to 40");
    }
    else
    {
        if(uname1.length<=4||uname2.length<=4)
        {
            alert("Username Must be between 5 to 100");
        }
        else
        {
            if(u1.match("-")||u2.match("-")||u1.match("_")||u2.match("_")||u1.match(".")||u2.match(".")||u1.match("0")||u2.match("0")||u1.match("1")||u2.match("1")||u1.match("2")||u2.match("2")||u1.match("3")||u2.match("3")||u1.match("4")||u2.match("4")||u1.match("5")||u2.match("5")||u1.match("6")||u2.match("6")||u1.match("7")||u2.match("7")||u1.match("8")||u2.match("8")||u1.match("9")||u2.match("9")||u1.match("a")||u2.match("a")||u1.match("b")||u2.match("b")||u1.match("c")||u2.match("c")||u1.match("d")||u2.match("d")||u1.match("e")||u2.match("e")||u1.match("f")||u2.match("f")||u1.match("g")||u2.match("g")||u1.match("h")||u2.match("h")||u1.match("i")||u2.match("i")||u1.match("j")||u2.match("j")||u1.match("k")||u2.match("k")||u1.match("l")||u2.match("l")||u1.match("m")||u2.match("m")||u1.match("n")||u2.match("n")||u1.match("o")||u2.match("o")||u1.match("p")||u2.match("p")||u1.match("q")||u2.match("q")||u1.match("r")||u2.match("r")||u1.match("s")||u2.match("s")||u1.match("t")||u2.match("t")||u1.match("u")||u2.match("u")||u1.match("v")||u2.match("v")||u1.match("w")||u2.match("w")||u1.match("x")||u2.match("x")||u1.match("y")||u2.match("y")||u1.match("z")||u2.match("z"))
            {
                submiting();
            }
            else
            {
                alert("Only [-,_,.],[0-9],[a-z] characters are allowed");
            }
        }
    }
   //document.getElementById("Create_Account_Control").disabled=true; 
}
function submiting()
{
    submit();
}

And at the End i created Servlet page:

package Classfiles;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class sfkcreateaccount extends HttpServlet 
{
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
    {
        PrintWriter out = response.getWriter();
        String fname,mname,lname,uname, pwd,cntri,gender;
        Date dob;
        java.util.Date db1;
        //db1=new java.util.Date(request.getParameter("dob"));
        fname=request.getParameter("fname");
        mname=request.getParameter("mname");
        lname=request.getParameter("lname");
        uname=request.getParameter("uname2");
        pwd=request.getParameter("pwd2");
        //dob=(Date) db1;
        out.println(fname);
        out.println(mname);
        out.println(lname);
        out.println(uname);
        out.println(pwd);
        //out.println(dob.toString());
    }
    @Override
    public String getServletInfo() {
        return "Short description";
    }
}

This Servlets always showing me null value So can any one tell me what to do to remove this error I also want to optimise the code so please help me.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
need help to remove and optimise the code for creating a page
need help to remove and optimise the code for creating a page   i have the following code but it has some sorts of error whenever i run the page... to retrive the parameters but it is always showing me null values. My Html page
Need some help creating an order form.
Need some help creating an order form.  Hi there. I am looking... found on the form html page are useful. My question is: can I tie them all together on one page, have them submited all at once to my email and how would I
Advertisements
need help creating a lift program - Java Beginners
need help creating a lift program  Classes, Methods, Constructors please i need help to create an elevator program Simulating an Elevator write... for any help rendered
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., along with the number of items sold..please help did a code 500 times cant
Need Help in creating online quiz application using JSP - JSP-Servlet
Need Help in creating online quiz application using JSP  Hi, i am creating online Quiz application using JSP and MySQl ,Apache 6 in Netbeans IDE. i... ---------------------------------------------------------------------------------------------------- JSP Page
PLZ HELP ME. i need php code.
PLZ HELP ME. i need php code.   I want php code for bellow OUTPUT. output is just example but it must be letters only. abc bcd efg jku rgt azs hje qqc wws adt
Need help
Need help  Dear sir, I have a problem. How to write JSP coding.... This name list should get from the database. Please help me. By the way, I'm using access database and jsp code. Thank you
Need help with this!
Need help with this!  Can anyone please help me... to a file at all at this time. Any help would be greatly appreciated, thank you...)); //creating arrays int [][] score = new int[27][50]; int
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
Need help
Need help  Hello... I need some help I have a method which contains 1 string value and i wnat when this method get called den that string value should b assigned as array name.. for example.. i have a method name() which
Need to Remove Duplicate Records from Excel Sheet
Need to Remove Duplicate Records from Excel Sheet  Need to Remove Duplicate Records from Excel Sheet. I have one excel sheet having two fields... empnum rating (without using sql query have to remove records from excel using java
need help for writting code in struts action class for check boxes and radio buttons - Struts
need help for writting code in struts action class for check boxes and radio buttons  Hello frnds, i need help from u esteemed and talented people.iwould like to write code in struts action class for check boxes and radio
need of code
need of code  howto convert greyscale image to binary image in java
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need code
need code  Create Vehicle having following attributes: Vehicle No., Model, Manufacturer and Color. Create truck which has the following additional... is the required code: import java.util.*; class Vehicle { int
need help please
need help please  Dear sir, my name is logeswaran. I have a big problem that I can't find the solution for a program. How can I block a user from enter a page second time. Please help me. By the way I'm using Access database
need source code fir automatic timesheet filling. can anyone peass help?
need source code fir automatic timesheet filling. can anyone peass help?  Hi friends, I wants to develop a software that should automatically fills the time sheet using the login and log out entries. Can anyone please help me
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.  I am reading the file using BufferedReader, then writing the output like this: String
Need Help on JMS - JMS
Need Help on JMS   Hi, In my application i need to create my own ques and my own QueueConnectionFactory..... Plz tell me how to create the same... Any help is appriciated,.. Thanks in advance
Need some help urgently
Need some help urgently  Can someone please help me with this below question. I need to write a class for this. If you roll Y standard six-sided dice... need to write a class for this where X and Y are passed as parameter. If someone
Need help with nested queries
Need help with nested queries  Hello, Table1 has "id", "votes" columns. Table2 has "id", "Name" column. I need to retrieve Name and its corresponging Votes. I tried with nested queries but its confusing. Can anyone please help
Need to remove duplicated rows from excel using apache POI API
Need to remove duplicated rows from excel using apache POI API  Hi, Need help from you. I am able to generate excel sheet with data also... to remove duplicated rows from excel. same as below i need to do by using apache
need help with program
need help with program  To write a program to read a set of words from a file and return the following 1)Each word in the file against its frequency 2) the frequency should be in the descending order of the frequencies
Need Help in Java programming
Need Help in Java programming  Hello. Can someone please help me with writing the following program Java program that gives assignment details such as:assignment number,assignment name,due date,submission date,percentage marks
need help to create applet
need help to create applet  Can u help me..?? I get a task ...and i dont know how to make it... So I hope that u can help me... Here is the task... e) CardLayout If u can help me, then please
need help...................please
need help...................please  I have a problem in my JSP Coding... should show in texfield that already create in the web page. I'm really stuck on this area. Please help me. By the way, I'm using access Database and JSP coding
need help with program
need help with program  To write a program where we can take two integer array as input,Find the missing number from array"B" has all the numbers from array"A" except one,and find the fastest way in doing
Need help on JAVA JSP
Need help on JAVA JSP  Hi, I have never worked on java and I have been given an assignment where I have to fix existing issues in the tool(created...(need to know how I can adjust it based on the cureen system's screen resolution
Friends need a help on ruby..
Friends need a help on ruby..  Friends i need a ruby script and the requirement is When i am running a ruby script in cmd, after executing my script, a html report will be generated having my console output details. For ex
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone  The Airport Valet Parking Company (AVP) is a company which... information; Bookings for the service need to be made at least 1 day in advance
need help - Java Beginners
need help  Need help in programming in Java  Simple java program that will show the output within quotes using system.out.println... the following code is this: public class print1{ public static void main(String
hello there i need help
hello there i need help  : i need to do a program like this: Automatic Teller Machine [B] Balance [D] Deposit [W] Withdrawal [Q] Quit select you... i am a beginner, and aside from that i am really eager to learn java please help
Need help with console program?
Need help with console program?  Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). thanks in advance.   Here is an example that repeatedly
Need Help With This Scenario
Need Help With This Scenario  The bonnet of a car is opened to determine if there is anything wrong with the engine. Firstly, the radiator water is checked. If the radiator water is below the minimum indicator level
Need Help With This Scenario
Need Help With This Scenario  The bonnet of a car is opened to determine if there is anything wrong with the engine. Firstly, the radiator water is checked. If the radiator water is below the minimum indicator level
Need help - Java Beginners
; Hi Friend, Please try the following code. We hope that this code will help...Need help   To Write a Java program that asks the users to enter a m * n matrix of integers, m and n being the number of rows and columns
Need help with my project
Need help with my project  Uses a while loop to perform the following steps: -Prompt the user to input two integers: firstNum and secondNum where... line in the file in the format yyyy-mm-dd hh:mm:ss.   The given code
Need Help - Java Beginners
Need Help  Hello Sir, Am a beginner of Java. Also i did course on J2EE... but dont have any ideas about real time projects. But i want to do some projects in Java as well as J2EE... Can u help me and guide to do a project
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer n is written n! (pronounced ‚?? n factorial‚??) and is defined as follows: n!=n . (n-1) . (n-2) . .... . 1 (for values of n greater than or equal to 1) and n!=1
Need Help on the script
Need Help on the script  hello there, My name is Femi and am a web developer using php. am working on a project. and am having some difficulties. i dont know if you can help me out with it. The platform am building will receive
Need help in java programming
Need help in java programming  Hello. Can someone please help me with writig the following programm. Assignment 20% Presentation 10% Mini Test... and terminating the application. Regards!   Hi Friend, Try the following code
Need sample code
Need sample code  Need code for graph which shows the performance comparission of aprior algorithm and coherent rule algorithm.plz can any one help me i need in a week
seriously need help....
seriously need help....  Write a program that will prompt the user to select an appliance, lookup the energy the appliance uses and for each time of use rate band: calculate the cost to run the appliance and display a bar graph
need JSP Code.
need JSP Code.  **Hi I need JSP code for selling Products which are in Database. Please can any one help for this.URGENT... Thank You..! Abhijeet
a jsp code for creating a text file
a jsp code for creating a text file  Hello,i need jsp code for creating a new text file for each user, when they login in to the website for creating a new data file. So i need a jsp code for following options. when user login
I have need to help
I have need to help  Write a program that, for four points A, B, C and P, draws a triangle formed by ABC and a small cross showing the position of P; and displays a line of text indicating which of the following three cases
Need a JSP CODE
Need a JSP CODE  *Hi I need JSP source code for selling products which are in database.. please can any one help me ..URGENT* Thank You
need help - Swing AWT
need help  Create a program to correct and grade a set of multiple choice test result. this is a console program that uses JOptionPane dialog boxes as well. Must read a set of 10 correct answers, using a JOptionPane dislog box
need help. - Java Beginners
program code and get to the output in uppercase letter.amar
 

 

 

DMCA.com