We help IT Professionals succeed at work.

Using <jsp:forward> to open Page in New window

mikesung99
mikesung99 used Ask the Experts™
on
Hi,

I'm experimienting with using <jsp.foward> to navigate to another page (and pass over some attributes). The following is a snippet of the code that I've been testing:-

            %>
             <jsp:forward page="DailyBarChart.jsp">
                    <jsp:param name="DailyStats"
                     value="<%= DailyStats %>" />                  
                    <jsp:param name="sCurrentDate"
                     value="<%=sCurrentDate %>" />
            
             </jsp:forward>
            <%


The above code works fine in that it will open up DailyBarChart.jsp in the same browser instance (and pass over the two attributes of DailyStats and sCurrentDate).

 However, I would like to open up the page in a seperate window - Is this possible - I've searched the various forums and web but I cannot as yet find anything to point me in the right direction.


Many Thanks

Michael

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Just to clarify, I need to open up the DailyBarChart.jsp page in a new window and also pass over the 2 attributes.
Commented:
You don't want to use a forward.  You need to use javascript. See example code below.    
<html>
<head>
  <script>
     function popup(){
      window.open("<%=request.getContextPath()%>/DailyBarChart.jsp?DailyStats=<%= DailyStats %>&sCurrentDate=<%=sCurrentDate%>","mywindow");
     }
  </script>
</head>
<body onload="popup();">
This page has opened(or tried to open) a window for your other page. It may have been blocked by pop-up blocker.
</body>
</html>

Open in new window