Hi,

I recalled that some one on this forum posted a similar problem that I'm having with 
the child-parent window issue which is more related to JavaScript. But, I couldn't 
find a solution to my issue in this forum's archive.

In my app, I need to:

1) submit the form to a specified action and save the data in db
2) close the child window (a modal window) 
3) and refresh its parent window with the updated data in db

I tested my code and it saved the data in the child window after invoking the action 
serlvet. But, after it closed the child window, it opened a new window instead of 
refreshing its parent window. The new window has the same layout and data as the 
parent window, hence, it get duplicated.

If some one has implemented this functionality in JavaScript, may I ask for your time 
to correct the doSave() JavaScript below so that the parent window would get refreshed.

Thanks a bunch!

Tuan


----- MainMenu.jsp (frameset) : JSP Code for Parent window ---------

<html:html>

  <script language="JavaScript">

    function openModal( theURL, name ){
      window.showModalDialog( theURL, '' ,'dialogWidth:662px;, dialogHeight:180px; 
help:no; scroll:no; status:no; center:yes; resizable:no; unadorned:yes;');
    }

  </script>

  
  <html:form name="salaryForm"
             action="/salary"
             type="com.xxx.form.SalaryForm">

  
    <td>
       <a href="JavaScript:void()" 
onclick="openModal('/editSalary.do?id=<%=employee.getEmployeeId()%>&action=edit'), 
'salary'"><img src="common/images/edit.gif" width="9" height="18" border="0" 
alt="edit"></a>
    </td>
  </html:form>

</html:html>


------- EditSalary.jsp: JSP Code for child (popup Modal window) ------

<html:html>

  <script language="JavaScript">
    function doSave() {
      //
      // need code to close the child window and refresh the 
      // parent window which opened the child window
      // ....
      // call form.submit() here and close the child window
      // self.close();
      //
    }
  </script>

  <html:form name="editSalayForm"
           action="/editSalary"
           type="com.xxx.form.EditSalaryForm"
           method="post">

     <input type="submit" name="btnSave" value="Save" onClick="doSave(); return 
false;">

  </html:form>

</html:html>


-------- struts-config action mapping -----------

    <!-- Process Salary tab -->
    <action path="/salary"
            type="com.xxx.action.SalaryAction"
            validate="false"
            input="/MainMenu.jsp"
            name="salaryForm"
            scope="request" >
            <set-property property="loginRequired" value="true" />
            <forward name="success" path="/MainMenu.jsp" />
            <forward name="failure" path="/login.do" />
    </action>
    <!-- Process employee salary edit -->
    <action path="/editSalary"
            type="com.xxx.action.EditEmployeeSalaryAction"
            validate="false"
            input="/EditSalary.jsp"
            name="editSalaryForm"
            scope="request" >
            <set-property property="loginRequired" value="true" />
            <forward name="success" path="/EditSalary.jsp" />
            <forward name="save" path="/salary.do" target="_top"/>
            <forward name="failure" path="/login.do" />
    </action>



<<winmail.dat>>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to