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

 
 


Rashpal Singh Johar
need help to remove and optimise the code for creating a page
0 Answer(s)      7 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.

View Answers









Related Pages:
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
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
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
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
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 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
Creating a Frame
, calender, combobox checkbox and many more for creating GUI in Java based... with your applet. Swing libraries is used for creating desktop applications...* Accessibility API Following the links below to learn Swing with the help
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 a jsp code
Need a jsp code  I need a jsp code in which when i select a value.....please help me for this.   The given code retrieves the employee name...;/table> </body> </html> 2)getvalue.jsp: <%@page import="java.sql.
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 fixing this - Java Beginners
Need *Help fixing this  I need to make this program prompt user... and maybe add retrieve function //need help with this one badly. Thanks guys for all the help. import java.text.*; import javax.swing.*; import java.awt.event.
need code for login in asp.net with c#
need code for login in asp.net with c#  hai iam trying to develop a project in asp.net with c#,so i need a code for login page using which admin and other users can log in.plz help me, thanks in advance
Need to remove duplicate rows from the Excel Sheet using the Apache POI API
Need to remove duplicate rows from the Excel Sheet using the Apache POI API   Hi There, Is any one aware of java code on how to find the duplicate... but no help :( Thanks
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
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
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 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
JavaScript Remove Element
the specified element.  Here is the code: <html> <h2>Remove... JavaScript Remove Element...; In this section, you will learn how to remove HTML element using JavaScript. JavaScript
I need help in doing this. - Java Beginners
I need help in doing this.  Student DataBase i will need creating..., and the student's GPA.using arrays and objects, need to structure the information... already written the Date class, so here is my date code.) public class Date
Need help in image uploading - JSP-Servlet
Need help in image uploading  hii, i have one doubt in uploading an image in jsp. I want to display image from DB to my jsp page. For that i... a folder named images in server but cant upload.Is any extra code need for uploading
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
JavaScript Remove Focus
window.focus(). But on clicking the button 'Remove Focus' from the 'hello.html' page... JavaScript Remove Focus...; In this section, you will learn how to remove focus from the window using JavaScript
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
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 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
JavaScript Remove Spaces
JavaScript Remove Spaces...; In this section, yow will learn how to remove spaces from the string. To remove the spaces...(' ') and then join all elements with no space string using join(''). Here is the code
creating web page for form registration
creating web page for form registration  I am creating web page for form registration to my department ..I have to Reprint the Application Form (i.e... anyone post sample code
need help. - Java Beginners
program code and get to the output in uppercase letter.amar
uiscrollview remove all subviews
uiscrollview remove all subviews  Hi, How to remove all elements from uiscrollview. I need code for uiscrollview remove all subviews. Thanks   Hi, You can use following code in your program to remove all sub childs
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 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
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
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 an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly... appreciate the help. basically I need to see what this would look like: create
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly... appreciate the help. basically I need to see what this would look like: create
Need an example of basic code.
Need an example of basic code.   Im working on an art project that I want to use some code in, and I am proficient in python but that looks fairly... appreciate the help. basically I need to see what this would look like: create
Java Programming Need Help ASAP
Java Programming Need Help ASAP  You are required to develop..., maths mark, communications mark. You will then need accessor and mutator methods... class that creates an array of Students and handles it. You will need
help
help  i need help with this code. write a java code for a method named addSevenToKthElement that takes an integer array, and an integer k as its arguments and returns the kth element plus 7. any help would be greatly
HELP
HELP  I need this code to open in a new web browser. but no matter what i do it wont please help?? Directive 055 Storage Requirements for the Upstream Petroleum Industry
Need urgent help with C++ errors!
Need urgent help with C++ errors!  hi, i'm new to C++ programming. this is my code... i'm using Turbo C++. It's showing so many errors!.. I don't know what to do. Please help!! #include<iostream.h> void main
help
help  i need ajava code for compressing files using huffman algorithm (run on netbeans correctly
need code for file browser
need code for file browser  hi, i need to write a code to browse the file in my computer using Jsp or java.. what is the code for file browser?   JSP Code for browsing: 1)page.jsp: <%@ page language="java" %>
code need - Java Beginners
)  Hi Friend, Try the following code. We hope this will help you...code need  hi i want to code doing for this. If i have enter the text file in my java project. example input is 1,2,3,4,5(it is in input text file
Remove duplicate values
. q1. how can i eliminate duplicate values during insertion? please i need code...Remove duplicate values  i am trying to insert values into database from excel spreadsheet .am doing it using JDBC.connected both excel and sql
Java remove()
. Description of the code: Here, you will get to know about the remove..., the remove method has already been called. In the program code given below, we... Java remove()      
i need help - Development process
i need help  hello, i need help regarding this program. this program gives ping to the system. import java.net.*; import java.io.*; import...?   hi subhash hope this code can help you, public class PingTest
Netbeans Question need help desperately!!
Netbeans Question need help desperately!!   Ok here is my code- public class RollDie2 { public static void main(String[] args) { Random..., number, frequency[die1][die2] + 1); okay that's the code....I'm trying to get
i need help plz .... Quickly
i need help plz .... Quickly   how can i count how many numbers enterd by the user so the output would be like this Total number of Scores = .... this is my code :- import java.util.Scanner; public class SCORES { public

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.