+
学生评教系统
+
+
请选择学院、老师以及课程,然后进入评教页面。
+
\ No newline at end of file
diff --git a/src/main/webapp/evaluationPage.jsp b/src/main/webapp/evaluationPage.jsp
index 988ee8d..2cb059a 100644
--- a/src/main/webapp/evaluationPage.jsp
+++ b/src/main/webapp/evaluationPage.jsp
@@ -1,27 +1,25 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*, org.json.JSONArray, org.json.JSONObject" %>
<%
- // 获取选择的学院、老师和课程
String college = request.getParameter("college");
String teacher = request.getParameter("teacher");
String course = request.getParameter("course");
if (college == null || teacher == null || course == null) {
- response.sendRedirect("evaluate.jsp"); // 如果参数缺失,跳回选择页面
+ response.sendRedirect("evaluation.jsp");
return;
}
- // 查询所有维度和题目
JSONArray dimensions = new JSONArray();
- int totalQuestionCount = 0; // 总题目数量
+ int totalQuestionCount = 0;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
- Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "123456");
+ Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "SchoolST", "123456");
String sql = "SELECT d.dimension_id, d.name AS dimension_name, d.weight, q.question_id, q.question_text " +
- "FROM dimensions d " +
- "JOIN questions q ON d.dimension_id = q.dimension_id " +
- "ORDER BY d.dimension_id, q.question_id";
+ "FROM dimensions d " +
+ "JOIN questions q ON d.dimension_id = q.dimension_id " +
+ "ORDER BY d.dimension_id, q.question_id";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
@@ -31,7 +29,6 @@
while (rs.next()) {
int dimensionId = rs.getInt("dimension_id");
if (dimensionId != lastDimensionId) {
- // 新维度
if (currentDimension != null) {
dimensions.put(currentDimension);
}
@@ -43,17 +40,14 @@
lastDimensionId = dimensionId;
}
- // 添加题目
JSONObject question = new JSONObject();
question.put("question_id", rs.getInt("question_id"));
question.put("question_text", rs.getString("question_text"));
currentDimension.getJSONArray("questions").put(question);
- // 统计总题目数量
totalQuestionCount++;
}
- // 添加最后一个维度
if (currentDimension != null) {
dimensions.put(currentDimension);
}
@@ -70,7 +64,6 @@