📄 index.jsp
字号:
<%@ page contentType="text/html;charset=gb2312" language="java" import="java.sql.*,java.io.*"%>
<%@ include file="include.inc"%>
<%
String years=request.getParameter("years");
//float[] month=new float[12];
float[] monthsum=new float[12];//每月的访问量
//String[] sess=new String[12];
String[] mon=new String[12]; //用于存储每月访问量所在的百分比
String[] aa=new String[12];
int j=0;
float sum=0;
Class.forName(CLASSFORNAME);
Connection con=DriverManager.getConnection(SERVER,USER,PWD);
Statement stmt=con.createStatement();
String isCorrect="select * from tb_month where years='"+years+"'";
ResultSet rs=stmt.executeQuery(isCorrect);
if(rs.next())
{
for(int i=0;i<monthsum.length;i++)
{
monthsum[i]=rs.getFloat(i+2);
sum=sum+monthsum[i];
}
for(j=0;j<monthsum.length;j++)
{
monthsum[j]=rs.getFloat(j+2);
//mon[j]=new Float((1-monthsum[j]/sum)*100).toString()+"%";
mon[j]=new Float((1-monthsum[j]/sum)*100).toString()+"%";
}
session.setAttribute("aa[0]",mon[0]);
session.setAttribute("aa[1]",mon[1]);
session.setAttribute("aa[2]",mon[2]);
session.setAttribute("aa[3]",mon[3]);
session.setAttribute("aa[4]",mon[4]);
session.setAttribute("aa[5]",mon[5]);
session.setAttribute("aa[6]",mon[6]);
session.setAttribute("aa[7]",mon[7]);
session.setAttribute("aa[8]",mon[8]);
session.setAttribute("aa[9]",mon[9]);
session.setAttribute("aa[10]",mon[10]);
session.setAttribute("aa[11]",mon[11]);
response.sendRedirect("show.jsp");
}
else
{
response.sendRedirect("view.jsp");
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -