Form authentication for JSP with JavaScript

zhaozj2021-02-16  81

Here is the argument I do. .

Made in Tomcat and WebLogic;

<% @ page language = "java" import = "java.lang. *, java.util. *, project.member, project.memberimp"%>

member orders </ title> <link rel = "stylesheet" type = "text / css" HREF = "/ adictProject / css / body.css"> <script type = 'text / javascript'> Function Validation (frm) {var isvalid = true;</p> <p>IF (frm.realname.value.length == 0) {Alert ("please input your realname!"); isvalid = false; return isvalid;} for (i = 0; i <frm.realname.value.length; i ) {// check what current character is letter. Var c = frm.realname.value.Charat (i);</p> <p>IF (! ("isletter (c))) {Alert (" RealName Only Contains AZ, AZ and Whitespace "; isvalid = false; return isvalid;}}}}}}}} .checked || frm.gender [1] .checked) {Alert ("please choose your associate"; isvalid = false; return isvalid;} if (frm.contact.value.length! = 8) {Alert "Length of Contact Number Must BE 8!"); Isvalid = false; return isvalid;} for (i = 0; i <8; i ) {var c = frm.contact.value.charat (i); if (! Isdigit (C)) {Alert ("Contact Number Only Contains Digits!"); isvalid = false; return isvalid;}}}}}}}} === -1) {ALERT (" Email Shoud Contains '@' "); isvalid = false; return isvalid;} if (frm.address.value.length == 0) {Alert (" please infut your address! "); Isvalid = false;} isvalid;} IF (frm.zipcode.value.Length == 0) {Alert ("please input the zipcode!"); isvalid = false; return isvalid;} for (i = 0; i <frm.zipcode.value.l ENGTH; I ) {var c = frm.zipcode.value.charat (i); if (! isdigit (c)) {Alert ("Zipcode Only Contains Digits!"); isvalid = false; return isvalid;}} return isvalid Function isletter (c) {return (((c> = "a") && (c <= "z")) || ((c> = "a") && (c <= "z")) (} Function isdigit (c) {return ((c> = "0") && (c <= "9"));} Function iswhitespace (c) {return (c == ");} </ script > </ HEAD> <</p> <p>Body> <center> <Table Border = "0" width = "768"> <tr> <! - header -> <td color colludan = "2"> <jsp: include page = "/ header.jsp" / > </ Td> </ tr> <tr> <! - menu & content -> <td valign = "top"> <! - menu -> <jsp: include page = "/ menu.jsp" /> </ Td> <td> <! Border = "0"> <form action = "/ adictProject / servlet / update" method = "pos" name = "οnsubmit =" Return Validation (this); "> <TR> <% IF (session.getattribute (" user ") == null) {%> <jsp: forward page =" / error.jsp "/> <} string path = Request.getServletPath (); path = path.substring (0, path.indexof ("member / modify.jsp")); string XML = Application.getRealPath (Path "XmlData / Members.xml); MemberImp IMP = New MEMBERIMP (); Member MEMBER = Imp.getMember ("User"). Tostring (), XML);%> <TD> <input type = "hidden" name = "Username" value = "<% = Member.getusername ()%> "/> <input type =" hidden "name =" value = "<% = Member.getPasswor D ()%> "/> <input type =" hidden "name =" repassword "value =" <% = Member.getPassword ()%> "/> <td> </ tr> <tr> <td> RealName: </ td> <td> <input type = "text"</p> <p>Name = "realname" value = "<% = Member.getRealName ()%>> </ td> <Tr> <TD colspan =" 2 "align =" center "> <input type =" name "Name =" Gnder "value =" maale "> Male <input type =" radio "name =" gender "value =" female "> female </ td> <tr> <td> Bith: </ td> <TD> <select Name = "day"> <option value = "1"> 1 </ option> <option value = "2"> 2 </ option> <option value = "3"> 3 </ option> <option value = "4 "> 4 </ option> <option value =" 5 "> 5 </ option> <option value =" 6 "> 6 </ option> <option value =" 7 "> 7 </ option> <option value = "8"> 8 </ option> <option value = "9"> 9 </ option> <option value = "10"> 10 </ option> <option value = "11"> 11 </ option> <Option VALUE = "12"> 12 </ option> <option value = "13"> 13 </ option> <option value = "14"> 14 </ option> <option value = "15"> 15 </ option> <option value = "16"> 16 </ option> <option value = "17"> 17 </ option> <option value = "18"> 18 </ option> <Option value = "19"> 19 </ option> <option value = "20"> 20 <</p> <p>/ Option> <option value = "21"> 21 </ option> <option value = "22"> 22 </ option> <option value = "23"> 23 </ option> <option value = "24"> 24 </ option> <option value = "25"> 25 </ option> <option value = "26"> 26 </ option> <option value = "27> 27 </ option> <option value =" 28 "> 28 </ option> <option value =" 29 "> 29 </ option> <option value =" 30 "> 30 </ option> <option value =" 31 "> 31 </ option> </ select> <select name = "month"> <option value = "1"> 1 </ option> <option value = "2"> 2 </ option> <option value = "3"> 3 </ option> <option value = "4"> 4 </ option> <option value = "5"> 5 </ option> <Option value = "6"> 6 </ option> <option value = "7"> 7 </ option> < Option value = "8"> 8 </ option> <option value = "9"> 9 </ option> <option value = "10"> 10 </ option> <Option value = "11"> 11 </ option > <Option value = "12"> 12 </ option> </ select> <select name = "year"> <op Tion Value = "1970"> 1970 </ option> <option value = "1971"> 1971 </ option> <</p> <p>Option value = "1972"> 1972 </ option> <option value = "1973"> 1973 </ option> <option value = "1974"> 1974 </ option> <option value = "1975> 1975 </ option > <Option value = "1976"> 1976 </ option> <option value = "1977> 1977 </ option> <option value =" 1978 "> 1978 </ option> <option value =" 1979 "> 1979 < / option> <option value = "1980"> 1980 </ option> <option value = "1981"> 1981 </ option> <option value = "1982"> 1982 </ option> <option value = "1983"> 1983 </ option> <option value = "1984"> 1984 </ option> <option value = "1985"> 1985 </ option> <option value = "1986"> 1986 </ option> </ select> </ TD> </ tr> <tr> <TD> Contact: </ td> <TD> <input type = "name =" contact "value =" <% = Member.getContact ()%>> </ TD> </ tr> <tr> <td> email: </ td> <TD> <input type = "text" name = "email" value = "<% = Member.GeteMail ()%>> </ TD> </ tr> <tr> <td> address: </ td> <td> <textarea name = "Address "Rows =" 3 "> <% = Member.getaddress ()%> </ textarea> </ td> </ tr> <tr> <td> zipcode: </ td></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-13782.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="13782" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.054</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'OkqWhrvK9lThtOCXDe5T_2FIjPCXjCSwamI77hptyv7pPMYLREOLXORIAKjlMtWkJKGdzhA2vjPmA_2BoRG7'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>