Dieser Artikel teilt die Form von Formular Schreibtechnologie für Ihre Referenz. Der spezifische Inhalt ist wie folgt
Schreiben Sie zurück, um die Java Spelling JS -Methode zu unterstützen:
/ ** * Back Form * * @param mRequest * @return */ public static String ReportmaptOrform (MAP MREQUEST) {return ReportbackMaptOrform (Mrequest, New String [] {}, "ReportbackMaptOrform"); } / ** * zurückschreiben * * @param mRequest * @param ignOrneName Definieren Sie, welche Schlüsselwerte Eingabe nicht zurückschreibt // Schreiben Sie den Wert des Kontrollkästchens in der Liste StringBuffer rtvalue = new StringBuffer () nicht zurück; rtvalue.Append ("var mform = new Object ();/n"); rtvalue.Append ("var indexArray = new Array ();/n"); rtvalue.Append ("FunktionsabschreibungsmaptOrform () {/n"); Iterator itmRequest = mrequest.keyset (). Iterator (); while (itmRequest.hasNext ()) {String tempkey = (String) itMRequest.Next (); Object tempValue = mRequest.get (tempey); if (tempkey.startswith ("venus") || tempey.startswith ("ranmin")) {Fortsetzung; } if (rmstringhelper.ArrayContainstring (ignOrName, tempey)) {Fortsetzung; } String tempvaluenew = ""; if (tempValue instanceof string) {// Wenn es sich um einen einzelnen Wert handelt, injizieren Sie direkt tempvaluenew = rmstringhelper.replacestringtoscript ((String) tempvalue); // Nachdem Sie es aus der Datenbank herausgenommen haben, müssen Sie rtValue.Append ("IndexArray [indexArray.length] =/" " + tempkey +"/";/n") konvertieren; rtvalue.Append ("mform [/" " + tempey +"/"] =/" " + tempvaluenew +"/";/n"); } else if (tempValue instanceof string []) {// Wenn es sich um einen Mehrwert handelt, setzen Sie in das Array rtvalue.append ("IndexArray [indexArray.length] =/" + tempkey + "/"/"/n"); String [] myarray = (String []) tempValue; if (tempkey.equals ("cmd") {tempvaluenew = rmstringhelper.replacestringtoscript (myarray [0]); rtvalue.Append ("mform [/" " + tempey +"/"] =/" " + tempvaluenew +"/";/n"); } else {rtvalue.append ("mform [/" " + tempey +"/"] = ["); für (int i = 0; i <myarray.length; i ++) {if (i> 0) rtValue.Append (","); tempvaluenew = rmstringhelper.replacestringtoscript (myArray [i]); rtvalue.Append ("/" " + tempvaluenew +"/""); } rtValue.Append ("];/n"); }} else if (tempValue -Instanz von Zeitstempel) {// Wenn es sich um einen Zeitstempel handelt, injizieren Sie direkt if (tempValue == null) {Fortsetzung; } tempvaluenew = rmstringhelper.replacestringtoscript (tempValue.toString (). Substring (0,19)); rtvalue.Append ("IndexArray [indexArray.length] =/" " + tempey +"/";/n"); rtvalue.Append ("mform [/" " + tempey +"/"] =/" " + tempvaluenew +"/";/n"); } else if (tempvalue instanceof bigDecimal) {tempvaluenew = rmstringhelper.replacestringtoscript (tempvalue.toString ()); rtvalue.Append ("IndexArray [indexArray.length] =/" " + tempey +"/";/n"); rtvalue.Append ("mform [/" " + tempey +"/"] =/" " + tempvaluenew +"/";/n"); } else {if (tempValue! } weitermachen; }} rtvalue.Append ("für (var i = 0; i <indexArray.length; i ++) {/n"); rtvalue.Append ("RepectbackValue (IndexArray [i]);/n"); rtvalue.Append ("}/n"); rtvalue.Append ("}/n"); rtvalue.Append (jsfunctionName + "();/n"); retValue.toString () return rtValue; } // Verwenden Sie diese Methode, um den Wert in die Anforderung in das MFORM -Objekt var mform = new Object () einzugeben. var indexArray = new Array (); function ReportbackMaptOrform () {indexArray [indexArray.length] = "att_id"; mform ["att_id"] = ""; IndexArray [indexArray.length] = "BusinessTypeoid"; MForm ["BusinessTypeoid"] = [""]; IndexArray [indexArray.length] = "Business_type1"; MForm ["Business_type1"] = ""; IndexArray [indexArray.length] = "Business_Type2"; MForm ["business_type2"] = "1"; IndexArray [indexArray.length] = "CMD"; MForm ["CMD"] = "SaveExaminerule"; IndexArray [indexArray.length] = "document_content"; MForm ["document_content"] = "s2"; IndexArray [indexArray.length] = "file_path"; mform ["file_path"] = ""; IndexArray [indexArray.length] = "File_Template"; mform ["file_template"] = ""; IndexArray [indexArray.length] = "gxl"; MForm ["gxl"] = "null"; IndexArray [indexArray.length] = "Eigentümer_ID"; Mform ["Eigentümer_ID"] = "S1"; für (var i = 0; i <indexArray.length; i ++) {schreibbackValue (IndexArray [i]); }} RecordBackMaptOrform (); Die Ausgabe ruft die JS -Methode auf, nachdem die Schlüsselanweisung JSP -Seite hinzugefügt wurde: <script langual = "javaScript"> <% // Formschreiben von Form (request.getAttribute (RuleexamineConstants out.print (rmvohelper.writeBackMaptoform ((java.util.map) request.getAttribute (RuleexamineConstants.request_write_back_form_values))); // Das Skript zum Ausgabe der Formschreibensabrechnung} map mapt = (java.util.map) request.getAttribute (RuleexamineConstants.request_write_back_form_values); System.out.print ("infois:"+mapt.entrySet ()); out.print ("alert (1);");%> </script> // Der Inhalt des JS -Formats, der tatsächlich von der obigen Anweisung injiziert wird, lautet wie folgt: var mform = new Object (); var indexArray = new Array (); function ReportmaptoForm () {indexArray [indexArray.length] = "_function_id_"; MForm ["_ function_id_"] = "3670212500000000050"; IndexArray [indexArray.length] = "CMD"; MForm ["cmd"] = "listbusinessTypepage"; für (var i = 0; i <indexArray.length; i ++) {schreibbackValue (IndexArray [i]); }} RecordBackMaptOrform (); // Nach der Injektion rufen Sie die Funktion "Record -Form -Methode Js Records -Formular" (InputName) {if (Form.elements [inputName] == undefined) {return false;} if (Form.Elements [inputName] .value! } if (form.elements [inputName] .Length! if (mform [inputName] [0] == undefined) {thisValue = new Array (); thisvalue [thisvalue.length] = mForm [InputName]; } if (form.elements [inputName] .Length! für (var j = 0; j <templengthen; j ++) {var thisObj = form.elements [inputName] [j]; für (var k = 0; k <thisvalue.length; k ++) {if (thisobj.value == thisvalue [k]) {if (thisoBj.Checked! brechen; } else if (thisobj.selected! brechen; }} else {if (thisoBj.Checked! } else if (thisobj.selected! }}}}}}}}}}Das Obige dreht sich alles um diesen Artikel, ich hoffe, es wird für das Lernen aller hilfreich sein.