title: how to open a new window from a JSP file?
body: <p>I need to open a new window from a jsp file. In a JSP file, I take in an input from the user and then send it as an argument to a java method which returns me back the url as a string. I then need to open this in a new window. How do I do that? Below is the jsp file(send_product.jsp) for your reference.</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@ page import="products.*" %&gt;
  &lt;!DOCTYPE html&gt;
  &lt;%
      productManager pm= new productManagerImpl();
      String myUrl= null;
  
  
      if (request.getParameter("product_id") != null) {
  
          // get the paramter
          String product_id = request.getParameter("product_id");
  
          try {
  
              //myUrl has the url. Have to open this in a new window
              myUrl = pm.getUrl(product_id);
  
          } catch (Exception ex) {
              ex.printStackTrace();
          }
  
      }
  
  %&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;Insert&lt;/title&gt;
      &lt;/head&gt;
      &lt;body bgcolor="wheat"&gt;
          &lt;h4 align="right"&gt;Send Product&lt;/h4&gt;
          &lt;hr color="red"/&gt;
          &lt;br/&gt;&lt;br/&gt;
          &lt;a href="index.jsp"&gt;Index&lt;/a&gt;
          &lt;form action="send_product.jsp" method="post"&gt;   
              &lt;% if (myUrl  != null &amp;&amp; !myUrl.equals("")) {%&gt;
              &lt;%= myUrl%&gt;
              &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  
              &lt;%
                  }
              %&gt;
  
              &lt;table width="75%" align="center" &gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          Please enter the information below and click "&lt;b&gt;Submit&lt;/b&gt;"
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;fieldset title="info"&gt;
                              &lt;table border="0" cellspacing="3" cellpadding="0" align="center"&gt;
                                  &lt;tr&gt;
                                      &lt;td align="right"&gt;
                                          * Product ID:
                                      &lt;/td&gt;
                                      &lt;td align="left"&gt;
                                          &lt;input type="text" size="20" maxlength="70" name="product_id"&gt;
                                      &lt;/td&gt;
                                  &lt;/tr&gt;
  
                              &lt;/table&gt;
                              &lt;hr /&gt;
  
                              &lt;div align="center"&gt;
                                  &lt;input type="submit" name="saveInfo" value="Submit"&gt;
                              &lt;/div&gt;
                          &lt;/fieldset&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>