From iteye blog http://pingchajava.iteye.com/blog/913973
Problem description:
On the child page, when the modified vertex is saved, save the data, close the data, and refresh the parent page to display the modified data.
1. on the parent page: the code of the subwindow is displayed when you click Modify (window. showmodaldialog is used to allow users to click this change to respond to other tasks ):
JS Code
- // The second parameter in the showmodaldialog form, which is the object of the current form
- <A href = "#" onclick = "window. showmodaldialog ('userupdate. do? Userid = <% = lo_dt.uf_getvalue (I, 0) %> ', window, 'dialogwidth: 480px; dialogheight: 180px; Status: No;') "> modify </a>
// The second parameter in the showmodaldialog form, which is the current form object <a href = "#" onclick = "window. showmodaldialog ('userupdate. do? Userid = <% = lo_dt.uf_getvalue (I, 0) %> ', window, 'dialogwidth: 480px; dialogheight: 180px; Status: No;') "> modify </a>
2. Save the changes in the Child Window and refresh the parent window:
1) Submit the current subpage to IFRAME during submission
HTML code
- // At this time, the form is submitted to IFRAME, and IFRAME is implicit.
- <IFRAME name = "commitarea" style = 'display: none; '> </iframe>
- <Form action = "usersave. Do" method = "Post" target = "commitarea">
- <Input type = "button" value = "save" class = "button" onclick = "check ();">
- </Form>
// At this time, the form is submitted to IFRAME. IFRAME is implicitly <IFRAME name = "commitarea" style = 'display: none; '> </iframe> <form action = "usersave. do "method =" Post "target =" commitarea "> <input type =" button "value =" save "class =" button "onclick =" check (); "> </form>
2) submit the form to an action.
Java code
- // Add the following statement to the submitted action method:
- Request. setattribute ("updateuserok", "modified ");
// Add the following statement request. setattribute ("updateuserok", "modified successfully") to the submitted action method ");
And forward it to the current subpage
3) Close the child page and refresh the parent page
JS Code
- <Logic: present name = "updateuserok">
- <SCRIPT>
- Alert ("saved successfully! ");
- // Dialogarguments is an object transmitted from the parent form.
- Window. dialogarguments. Window. Location = "user. Do ";
- Self. Close ();
- </SCRIPT>
- </Logic: Present>
<Logic: present name = "updateuserok"> <SCRIPT> alert ("saved successfully! "); // Dialogarguments is the object window passed by the parent form. dialogarguments. window. location = "user. do "; self. close (); </SCRIPT> </logic: Present>
At this time, the user. Do enters the database search and jumps to the parent page.