Hi,
Follow Following Steps
-
1) Create scripts.js file and add following content
function popupaddpackage(urlToOpen) {
var window_width = screen.availWidth/5;
var window_height = screen.availHeight/5;
var window_left = (screen.availWidth/2)-(window_width/2);
var window_top = (screen.availHeight/2)-(window_height/2);
var winParms = "fullscreen=no"+",location=no"+",menubar=no"+",titlebar=no"+",toolbar=no"+",Status=no" + ",resizable=no" + ",height="+window_height+",width="+window_width + ",left="+window_left+",top="+window_top;
var newwindow = window.open(urlToOpen,'_blank',winParms);
newwindow.focus()
}
2) Create any JSP, like test,jsp and add following content
**************************************************************
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><title>Simple jsp page</title></head>
<body>Place your content here in test.jsp</body>
</html>
3) Now call your javascript file , so create index.jsp and add following contents
--
<%@ page import="org.apache.struts.action.ActionErrors" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<HTML>
<script LANGUAGE="JavaScript" SRC="scripts.js"></script>
<BODY>
<html:form action="/actions/showSample">
<TABLE ALIGN="CENTER" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
<html:submit onclick="popupaddpackage('test.jsp')" value="Add Package" style="height:23;width:100"/>
</TD>
</TR>
</TABLE>
</html:form>
</BODY></HTML>
Hope you got it, please let me know if you faced problem
--
Amit Pandya
amitpandya75@gmail.com