title: Different behavior on click of two buttons on same page in Struts 2
body: <p>I have <code>test.jsp</code> which has two buttons.on click of Display Chart button,it should open chart on new page which is happening using <code>target=_blank</code> in form tag. But problem is i don't want this behavior on click of Display Data button. On click of this button,I want to display data fetched on same page only,but currently for this button as well it is opening a new window .</p>
  
  <p><strong>My code is:</strong></p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
  "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Data&lt;/title&gt;
  &lt;s:head theme="ajax" debug="true"/&gt;
  &lt;/head&gt;
  &lt;body bgcolor="white"&gt;
  
  &lt;s:form validate="true" target="_blank"&gt;
  &lt;table&gt;
  
  //Mapping of data from database
  
  &lt;/table&gt;
  
  &lt;s:submit id="submit" value="Display Chart" align="left" action="testAction"/&gt;
  &lt;s:submit value="Display Data" align="left" action="displayDataAction"/&gt;`
    &lt;/s:form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <pre class="lang-java prettyprint-override"><code>public class TestAction  extends ActionSupport{
  
      public String execute() throws Exception {
  
          //code to populate DataSet
  
          chart = ChartFactory.createBarChart(
                 "Bar Chart",     //Chart title
              "",     //Domain axis label
              "MARKETS",         //Range axis label
              dataSet,         //Chart Data 
              PlotOrientation.VERTICAL, // orientation
              true,             // include legend?
              true,             // include tooltips?
              false             // include URLs?
          );
       chart.setBorderVisible(true);
       return SUCCESS;
      }
  }
  </code></pre>
  
  <p><strong><code>struts.xml</code>:</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;action name="testAction" 
          class="testAction" 
          method="execute"&gt;
               &lt;result name="success" type="chart"&gt;
                  &lt;param name="value"&gt;chart&lt;/param&gt;
                  &lt;param name="type"&gt;jpeg&lt;/param&gt;
                  &lt;param name="width"&gt;600&lt;/param&gt;
                  &lt;param name="height"&gt;400&lt;/param&gt;
              &lt;/result&gt; 
  &lt;/action&gt;
  
  &lt;action name="displayDataAction" 
          class="testAction" 
          method="getData"&gt;
              &lt;result name="success"&gt;test.jsp&lt;/result&gt;
  &lt;/action&gt;
  </code></pre>