waysun一路阳光

不轻易服输,不轻言放弃.--心是梦的舞台,心有多大,舞台有多大。踏踏实实做事,认认真真做人。

  BlogJava :: 首页 :: 新随笔 :: 联系 ::  :: 管理 ::
  167 随笔 :: 1 文章 :: 64 评论 :: 0 Trackbacks
list.jsp页面点XXX字就用window.showModalDialog弹出一个页面a.html里有个提交表单,提交以后,在后台action处理,新页面上有个返回,点返回还能出现index.jsp这个怎么实现呢?
1.index.jsp<org!init.action>
  </head>
    <frameset cols="20%,*" frameborder="no" border="0" framespacing="0">
 <frame src="org!orgTree.action" name="orgTreeFrame" scrolling="no" noresize="noresize" id="orgTreeFrame" /><struts里对应tree.jsp>
 <frame src="org!orgList.action" name="orgListFrame" id="orgListFrame" /><struts里对应list.jsp>

  </frameset>
2.

 public String orgTree()
 {
  return "orgTree";
 }
 public String orgList()
 {
  return "orgList";
 }

3.list.jsp
              var urls="org!toAdd.action?"+str;
              var loc_x = (window.screen.width-300)/2;       //获得窗口的垂直位置;
                 var loc_y = (window.screen.height-300)/2;           //获得窗口的水平位置;
                 var width=450;
                 var height=300;
              var re=window.showModalDialog(urls,parent,"edge:raised;scroll:1;status:0;help:0;resizable:1;dialogWidth:"+width+"px;dialogHeight:"+height+"px;dialogTop:"+loc_y+"px;dialogLeft:"+loc_x+"px",true);
 public String toAdd()
 {
  return "toAdd";
 }
4.add.jsp
 function add()
 {
     var fom=document.forms.addForm;
    
     fom.action="org!add.action";
     fom.target="orgListFrame";
     fom.submit();
     window.close();
 }
5.
    <package name="org" extends="struts-default" namespace="/">
  <action name="org!*" method="{1}"
   class="com.ssh.action.OrganizationAction">
   <result name="init">index.jsp</result>
   <result name="orgTree">.jsp</result>
   <result name="orgList">.jsp</result>
   <result name="toAdd">jsp/system/org/addorg.jsp</result>

  </action>
 </package>

 public String add()
 {
  try {
   response.sendRedirect("org!orgList.action");
   
  } catch (IOException e) {

   e.printStackTrace();
  }
  return null;
 }

posted on 2010-01-08 14:48 weesun一米阳光 阅读(5138) 评论(2)  编辑  收藏

评论

# re: 模态窗口提交到山顶到struts2的action后关闭自身并返回到父窗口,父窗口为一个iframe[未登录] 2014-09-10 11:27 苏打水
fsfsfsfsfsfs  回复  更多评论
  

# re: 模态窗口提交到struts2的action后关闭自身并返回到父窗口,父窗口为一个iframe[未登录] 2014-11-27 15:06 断点
顶顶顶顶  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: