2013年10月22日星期二

json, action, jsp problems, troubled for several days

Process is like this , there are about two a jsp iframe, respectively a.jsp b.jsp
a.jsp have a text box, a button to a form submitted to the action , the data is converted to json ,
passed to the js inside b.jsp processed , do not know where the problem ( first contact )
action code : JSONArray jsonArray = JSONArray.fromObject (listt); / / list is converted to json array
PrintWriter out = null;
out = resp.getWriter ();
out.print (jsonArray.toString ());
out.flush ();
out.close ();
return null;
xml configuration file :
/ history / zuoce.jsp
/ history / ditu.jsp


messy now , do not know how to do ...
------ Solution ------------------------- -------------------
$ (document). ready (function () {
$ ("# Button1"). click (function () {
$. ajax ({
type: " post ",
url: " <% = basePath%> / log / query.action? method = query ",
data: " name = "+ $ (" # Text1 "). val (),
dataType: "json / xml / html ",
success: function (result) {
try {
var obj = ; eval ('(' + result + ')');
alert (obj.name);
} catch (e) {
window.location = ".. / index.jsp "
}
}
});
});
});
------ Solution ------- -------------------------------------

  
  
brother you really amazing thank you so much this really can be before I tried this a new generation , but will overwrite the left of this page a. jsp why this appears in b.jsp in it because it added a target = "iframe name ( right ) " ?   Then give sub it

------ For reference only ---------------------------------------


b.jsp in the js code does not know how to write
------ For reference only ---------------------- -----------------
json written jsom the
------ For reference only -------------- -------------------------
jsom ">
------ For reference only ------------ ---------------------------
click the button to submit the form to the way you deal with json iframe2.src = url

assembled josn data is added to the set method inside JSONArray

Back b.jsp then you can get to the data page of the


------ For reference only ---------------------------------- -----


that code is a hand to play, did not pay attention to the wrong
------ For reference only -------------------- -------------------



This code is my temporary hand up not a COPY of play . . Please ignore
------ For reference only ------------------------------------ ---


button to submit the json action to deal with this step I have no problem , the question now is how Ban json b.jsp js code passed to go, what you said is how to return back ? direct return will overwrite the original a.jsp
------ For reference only --------------------- ------------------
or jqury you are using ajax to submit the form ?
------ For reference only -------------------------------------- -
the callback function parse your json data
------ For reference only --------------------- ------------------


no use is directly in the form action = "" go in here sumibt submitted
------ For reference only ------ ---------------------------------


You mean that eval it ? I will resolve this here now I do not know how to pass to the action in the json b.jsp go inside. . And a.jsp not change
------ For reference only -------------------------------- -------
you do not refresh the page a.jsp page will not become ah
------ For reference only ------------ ---------------------------

  
no use is directly in the form action = "" go in here sumibt submitted  
you use the form submission , then you put the json string into shared objects in ah is request , XML is configured to be forwarded to B.JSP. in your form action = "" add target = "iframe name ( right ) ," in the js b.jsp EL expressions can be used to obtain enough shared object string.
------ For reference only -------------------------------------- -
form action = "" add target = "iframe name ( right ) " so you forwarded a page will be displayed in the specified iframe .
------ For reference only -------------------------------------- -


not refresh a.jsp is to use AJAX to submit it . . . This is not really understand that the above is submitted a.jsp code inside it
------ For reference only ------------------ ---------------------

    
no use is directly in the form action = "" go in here sumibt submitted          
you use the form submission , then you put the json string into shared objects in ah is request , XML is configured to be forwarded to B.JSP. in your form action = "" add target = "iframe name ( right ) ," in the js b.jsp EL expressions can be used to obtain enough shared object string.  

You say I am an XML configuration to be forwarded to b.jsp this is how mean ? In the action in return "XX" and then configure the corresponding xml in / b.jsp this mean ?
------ For reference only -------------------------------------- -
En
------ For reference only ---------------------------------------



brother you really amazing thank you so much this really can be before I tried this a new generation , but will overwrite the left of this page a. jsp why this appears in b.jsp in it because it added a target = "iframe name ( right )"?
------ For reference only ---------------------------------------

    
    
brother you really amazing thank you so much this really can be before I tried this a new generation , but will overwrite the left of this page a. jsp why this appears in b.jsp in it because it added a target = "iframe name ( right ) " ?          Then give sub it
    

uh how to . . .
------ For reference only -------------------------------------- -
target = "" is the definition of a form to the back and then forward the position shown , target = "iframe name ( right ) will be in your way B.jsp specified iframe display. does not define the target will overwrite the original forwarded iframe content .
------ For reference only ------------------------- --------------

      
      
brother you really amazing thank you so much this really can be before I tried this a new generation , but will overwrite the left of this page a. jsp why this appears in b.jsp in it because it added a target = "iframe name ( right ) " ?                Then give sub it
         
         
  
  
  
uh how to . . .   left corner posts , knot stickers.
------ For reference only -------------------------------------- -


Thank you so much and learned a
------ For reference only ---------------------- -----------------
  The reply deleted by an administrator at 2013-10-22 08:51:43

------ For reference only ---------------------------------- -----
brother, is the junction stickers count points Mody ? ...

没有评论:

发表评论