1
test.jsp
페이지의 단추를 클릭 할 때 막 대형 차트를 표시하려고합니다. 차트를 표시 할 수 있지만 동일한 브라우저 (예 : test.jsp
)에 이미지로 열립니다. 새 창에 표시하고 싶습니다. 어떻게 할 수 있습니까?다른 창에 막 대형 차트 표시
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;
}
}
다음 내 struts.xml
입니다 :
에 따라 내 행동한다 : 나는 Struts2와 JFreeChart를 사용하고
<action name="testAction"
class="testAction"
method="execute">
<result name="success" type="chart">
<param name="value">chart</param>
<param name="type">jpeg</param>
<param name="width">600</param>
<param name="height">400</param>
</result>
</action>
<action name="displayDataAction"
class="testAction"
method="getData">
<result name="success">test.jsp</result>
</action>
JSP로하는 것입니다 :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Data</title>
<s:head theme="ajax" debug="true"/>
</head>
<body bgcolor="white">
<s:form validate="true" target="_blank">
<table>
//Mapping of data from database
</table>
<s:submit id="submit" value="Display Chart" align="left" action="testAction"/>
<s:submit value="Display Data" align="left" action="displayDataAction"/>`
</s:form>
</body>
</html>
조치 방법은 무엇입니까? jquery/js 또는 jsp를 사용 하시겠습니까? 코드를 붙여 넣을 수 있습니까? – SMA
안녕하세요 Almas, 다음과 같이 test.jsp에서 조치가 호출됩니다.
–s : form을 form으로 변경하십시오. 이런 식으로