JSP中在html插入java代码,执行时一直报错,如图:
<%@page import="com.matrixone.apps.program.ProgramCentralConstants"%>
<%@include file = "../emxUICommonAppInclude.inc"%>
<%@page import = "com.matrixone.apps.domain.*"%>
<%@include file = "../common/emxUIConstantsInclude.inc"%>
<%@include file = "../emxStyleDefaultInclude.inc"%>
<%@page import="com.matrixone.apps.domain.DomainObject"%>
<%@page import="com.matrixone.apps.domain.util.MapList"%>
<%@page import="matrix.db.Context"%>
<%@page import="matrix.util.StringList"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%!
MapList list1 = new MapList();
MapList list2 = new MapList();
MapList list3 = new MapList();
MapList list4 = new MapList();
StringList busSelects1 = null;
StringList busSelects2 = null;
StringList busSelects3 = null;
StringList busSelects4 = null;
String whereExpression1 = null;
String whereExpression2 = null;
String whereExpression3 = null;
String whereExpression4 = null;
int num1 = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int total = 0;
int count = 0;
int[] num = null;
String titleText = null;
String name1 = null;
String name2 = null;
String name3 = null;
String name4 = null;
String[] nameJs = null;
%>
<HTML>
<HEAD>
<%
String value = request.getParameter("plugin");
if("test2".equalsIgnoreCase(value)){
titleText = "标准化等级分析";
num = new int[3];
//gnssStandardizedGrade = Component_commonality
whereExpression1 = "(attribute[gnssStandardizedGrade]=='Component_commonality') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects1 = new StringList(1);
busSelects1.add(DomainObject.SELECT_ID);
list1 = DomainObject.findObjects(context, null, null, whereExpression1, busSelects1);
num1 = list1.size();
name1 = "通用件";
num[0] = num1;
//gnssStandardizedGrade = Standard_component
whereExpression2 = "(attribute[gnssStandardizedGrade]=='Standard_component') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects2 = new StringList(1);
busSelects2.add(DomainObject.SELECT_ID);
list2 = DomainObject.findObjects(context, null, null, whereExpression2, busSelects2);
num2 = list2.size();
name2 = "标准件";
num[1] = num2;
//gnssStandardizedGrade = Special_purpose_item
whereExpression3 = "(attribute[gnssStandardizedGrade]=='Special_purpose_item') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects3 = new StringList(1);
busSelects3.add(DomainObject.SELECT_ID);
list3 = DomainObject.findObjects(context, null, null, whereExpression3, busSelects3);
num3 = list3.size();
name3 = "专用件";
num[2] = num3;
num4 = 0;
nameJs = new String[]{"通用件","标准件","专用件"};
count = 3;
}else if ("test1".equalsIgnoreCase(value)){
titleText = "优选等级分析";
num = new int[4];
whereExpression1 = "(attribute[gnssPreferredLevel]=='Preferred') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects1 = new StringList(1);
busSelects1.add(DomainObject.SELECT_ID);
list1 = DomainObject.findObjects(context, null, null, whereExpression1, busSelects1);
num1 = list1.size();
name1 = "优选";
num[0] = num1;
// gnssPreferredLevel=Limited
whereExpression2 = "(attribute[gnssPreferredLevel]=='Limited') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects2 = new StringList(1);
busSelects2.add(DomainObject.SELECT_ID);
list2 = DomainObject.findObjects(context, null, null, whereExpression2, busSelects2);
num2 = list2.size();
name2 = "限选";
num[1] = num2;
// gnssPreferredLevel=Banned
whereExpression3 = "(attribute[gnssPreferredLevel]=='Prohibition') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects3 = new StringList(1);
busSelects3.add(DomainObject.SELECT_ID);
list3 = DomainObject.findObjects(context, null, null, whereExpression3, busSelects3);
num3 = list3.size();
name3 = "禁采";
num[2] = num3;
// gnssPreferredLevel=Prohibition
whereExpression4 = "(attribute[gnssPreferredLevel]=='Banned') && (type=='gnssMaterialPart'||type=='gnssSemiFProductPart') && (current!='Obsolete')";
busSelects4 = new StringList(1);
busSelects4.add(DomainObject.SELECT_ID);
list4 = DomainObject.findObjects(context, null, null, whereExpression4, busSelects4);
num4 = list4.size();
name4 = "禁选";
num[3] = num4;
nameJs = new String[]{"优选","限选","禁采","禁选"};
count = 4;
}
}
total = num1+num2+num3+num4;
%>
<script type="text/javascript" src="../common/scripts/jquery-latest.js"></script>
<script type="text/javascript" src="../plugins/highchart/3.0.2/js/highcharts.js"></script>
<script type="text/javascript" src="../plugins/highchart/3.0.2/js/modules/exporting.js"></script>
<script type="text/javascript" src="scripts/styleCharts.js"></script>
<script>
var gnssStandardizedGradeAnalyse;
$(document).ready(function() {
gnssStandardizedGradeAnalyse = new Highcharts.Chart({
chart: {
renderTo: 'gnssStandardizedGradeAnalyse',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: '<%=titleText%>'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>',
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ Highcharts.numberFormat(this.percentage, 1) +'% ('+
Highcharts.numberFormat(this.y, 0, ',') +' \u4E2A)';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
},
formatter: function() {
if (this.percentage > 4) return this.point.name;
},
showInLegend: true
}
},
credits: {
enabled : false
},
exporting:{
enabled : false
},
series: [{
type: 'pie',
name: '\u5360\u6BD4',
data: [
['<%=name1%>', <%=num1%>],
['<%=name2%>', <%=num2%>],
{
name: '<%=name3%>',
y: <%=num3%>,
sliced: true,
selected: true
},
['<%=name4%>', <%=num4%>],
]
}]
});
});
</script>
</HEAD>
<body>
<!--<div id="gnssOptimumLevelAnalyse" style="width: 550px; height: 400px; margin: 0 auto; float: left"></div>-->
<div id="gnssStandardizedGradeAnalyse" style="width: 550px; height: 400px; margin: 0 auto; float: left"></div>
<!--<div id="gnssKeyItemAnalyse" style="width: 550px; height: 400px; margin: 0 auto; float: left"></div>-->
<table border="1" align="center">
<tr>
<td align="center">名称</td>
<td align="center">数量</td>
</tr>
<%
for(int i=0;i<nameJs.length;i++){
%>
<tr>
<td align="center"><%=i%></td>
<td align="center"><%=nameJs[i]%></td>
</tr>
<%}%>
</table>
<!--<p><%=name1%>数量:<%=num1%> pcs</p><br>
<p><%=name2%>数量:<%=num2%> pcs</p><br>
<p><%=name3%>数量:<%=num3%> pcs</p><br>
<p><%=name4%>数量:<%=num4%> pcs</p><br>-->
<b>合计数量:<%=total%> pcs</b><br><br>
<form id="test" method="post" action="gnssTest.jsp">
<select id="mySelect" name="plugin" onchange="a(this)">
<option value="test2">标准化等级分析</option>
<option value="test1">优选等级分析</option>
<option value="test3">管控等级分析</option>
</select>
<input id="change" type="submit" value="提交"/><br>
</form>
</body>
</HTML>