案例说明:学习完javaweb的所有技术栈后用来上手的小项目有,用到的技术栈有jsp+JDBC+servlet,使用的工具是idea2022版+tomcat8.0.53
gitee 地址:MSTU3: 一个简单的入门小项目 (gitee.com)
目录
项目功能演示:
1.登录
2.首页
3.人员管理(在此界面可以进行人员信息的修改)
4.任务管理(此界面可以进行任务的修改删除)编辑
5.我的信息编辑
6.退出系统,返回登录界面编辑
项目代码:
bean包
数据交互层(此处省略了接口):
数据库连接工具:
业务逻辑层(此处省略了接口):
数据库连接信息:
静态页面(其中用到的一些图片需要自己提供):
项目功能演示:
1.登录
2.首页
3.人员管理(在此界面可以进行人员信息的修改)
文章来源:https://www.toymoban.com/news/detail-764380.html
4.任务管理(此界面可以进行任务的修改删除)
5.我的信息
6.退出系统,返回登录界面
项目代码:
bean包
package com.bean;
/**
* @BelongsProject: MSTU1
* @BelongsPackage: com.bean
* @FileName: Person
* @Author: 峰。
* @Date: 2023/8/21-19:47
* @Version: 1.0
* @Description:
*/
public class Person {
private String userAccount;
private int userIdentify;
private String userName;
private String userSex;
private String userBirthday;
private String userIdCard;
private String userPassword;
private String userOtherName;
public Person() {
}
public Person(String userAccount, String userPassword) {
this.userAccount = userAccount;
this.userPassword = userPassword;
}
@Override
public String toString() {
return "Person{" +
"userAccount='" + userAccount + '\'' +
", userIdentify=" + userIdentify +
", userName='" + userName + '\'' +
", userSex='" + userSex + '\'' +
", userBirthday='" + userBirthday + '\'' +
", userIdCard='" + userIdCard + '\'' +
", userPassword='" + userPassword + '\'' +
", userOtherName='" + userOtherName + '\'' +
'}';
}
public Person(String userAccount, int userIdentify, String userName, String userSex, String userBirthday, String userIdCard, String userPassword, String userOtherName) {
this.userAccount = userAccount;
this.userIdentify = userIdentify;
this.userName = userName;
this.userSex = userSex;
this.userBirthday = userBirthday;
this.userIdCard = userIdCard;
this.userPassword = userPassword;
this.userOtherName = userOtherName;
}
public String getUserAccount() {
return userAccount;
}
public void setUserAccount(String userAccount) {
this.userAccount = userAccount;
}
public int getUserIdentify() {
return userIdentify;
}
public void setUserIdentify(int userIdentify) {
this.userIdentify = userIdentify;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserSex() {
return userSex;
}
public void setUserSex(String userSex) {
this.userSex = userSex;
}
public String getUserBirthday() {
return userBirthday;
}
public void setUserBirthday(String userBirthday) {
this.userBirthday = userBirthday;
}
public String getUserIdCard() {
return userIdCard;
}
public void setUserIdCard(String userIdCard) {
this.userIdCard = userIdCard;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public String getUserOtherName() {
return userOtherName;
}
public void setUserOtherName(String userOtherName) {
this.userOtherName = userOtherName;
}
}
package com.bean;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.bean
* @FileName: studentTask
* @Author: 峰。
* @Date: 2023/8/23-17:11
* @Version: 1.0
* @Description:
*/
public class studentTask {
private String taskAccount;
private String studentAccount;
private String studentAnswer;
private int isFinish;
private int Score;
private String StudentName;
public studentTask() {
}
public studentTask(String taskAccount, String studentAccount, String studentAnswer, int isFinish, int score,String S) {
this.taskAccount = taskAccount;
this.studentAccount = studentAccount;
this.studentAnswer = studentAnswer;
this.isFinish = isFinish;
Score = score;
this.StudentName=S;
}
public String getStudentName() {
return StudentName;
}
public void setStudentName(String studentName) {
StudentName = studentName;
}
public String getTaskAccount() {
return taskAccount;
}
public void setTaskAccount(String taskAccount) {
this.taskAccount = taskAccount;
}
public String getStudentAccount() {
return studentAccount;
}
public void setStudentAccount(String studentAccount) {
this.studentAccount = studentAccount;
}
public String getStudentAnswer() {
return studentAnswer;
}
public void setStudentAnswer(String studentAnswer) {
this.studentAnswer = studentAnswer;
}
public int getIsFinish() {
return this.isFinish;
}
public void setIsFinish(int isFinish) {
this.isFinish = isFinish;
}
public int getScore() {
return Score;
}
public void setScore(int score) {
Score = score;
}
@Override
public String toString() {
return "studentTask{" +
"taskAccount='" + taskAccount + '\'' +
", studentAccount='" + studentAccount + '\'' +
", studentAnswer='" + studentAnswer + '\'' +
", isFinish=" + isFinish +
", Score=" + Score +
'}';
}
}
package com.bean;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.bean
* @FileName: task
* @Author: 峰。
* @Date: 2023/8/23-15:16
* @Version: 1.0
* @Description:
*/
public class task {
private String task;
private String teacherAccount;
private String taskDate;
private String taskName;
public task() {
}
public task(String task, String teacherAccount, String taskDate, String taskName) {
this.task = task;
this.teacherAccount = teacherAccount;
this.taskDate = taskDate;
this.taskName = taskName;
}
@Override
public String toString() {
return "task{" +
"task='" + task + '\'' +
", teacherAccount='" + teacherAccount + '\'' +
", taskDate='" + taskDate + '\'' +
", taskName='" + taskName + '\'' +
'}';
}
public String getTask() {
return task;
}
public void setTask(String task) {
this.task = task;
}
public String getTeacherAccount() {
return teacherAccount;
}
public void setTeacherAccount(String teacherAccount) {
this.teacherAccount = teacherAccount;
}
public String getTaskDate() {
return taskDate;
}
public void setTaskDate(String taskDate) {
this.taskDate = taskDate;
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
}
数据交互层(此处省略了接口):
package com.Dao;
import com.DBUtiles.DBUtils;
import com.bean.Person;
import com.bean.studentTask;
import com.bean.task;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.Dao
* @FileName: commonDaoImpl
* @Author: 峰。
* @Date: 2023/8/26-14:33
* @Version: 1.0
* @Description:
*/
public class commonDaoImpl implements commonDao{
@Override
public void deletePerson(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
int res = 0;
List<studentTask> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
res = preparedStatement.executeUpdate();
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
@Override
public List<Person> getAllTea(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<Person> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
Person person = new Person();
person.setUserName(resultSet.getString("userName"));
person.setUserSex(resultSet.getString("userSex"));
person.setUserIdCard(resultSet.getString("userIdCard"));
person.setUserOtherName(resultSet.getString("userOtherName"));
person.setUserIdentify(resultSet.getInt("userIdentify"));
person.setUserAccount(resultSet.getString("userAccount"));
person.setUserPassword(resultSet.getString("userPassword"));
person.setUserBirthday(resultSet.getString("userBirthday"));
personLsit.add(person);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
@Override
public void selectTea(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
int res = 0;
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
res = preparedStatement.executeUpdate();
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
@Override
public List<studentTask> getMyTask(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<studentTask> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
studentTask st = new studentTask();
st.setIsFinish(resultSet.getInt("isFinish"));
st.setScore(resultSet.getInt("Score"));
st.setStudentAccount(resultSet.getString("StudentAccount"));
st.setTaskAccount(resultSet.getString("taskAccount"));
st.setStudentName(resultSet.getString("userName"));
st.setStudentAnswer(resultSet.getString("studentAnswer"));
personLsit.add(st);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
}
package com.Dao;
import com.DBUtiles.DBUtils;
import com.bean.Person;
import com.bean.task;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.Dao
* @FileName: ManageDaoImpl
* @Author: 峰。
* @Date: 2023/8/22-20:11
* @Version: 1.0
* @Description:
*/
public class ManageDaoImpl implements ManageDao{
@Override
public List<Person> getAllPerson() {
String sql = "select * from person where userIdentify != 2";
return getAPerson(sql);
}
@Override
public List<task> getAllTask(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<task> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
task task = new task();
task.setTask(resultSet.getString("taskAccount"));
task.setTaskDate(resultSet.getString("taskDate"));
task.setTaskName(resultSet.getString("taskName"));
task.setTeacherAccount(resultSet.getString("teacherAccount"));
personLsit.add(task);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
private List<Person> getAPerson(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<Person> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
Person person = new Person();
person.setUserName(resultSet.getString("userName"));
person.setUserSex(resultSet.getString("userSex"));
person.setUserIdCard(resultSet.getString("userIdCard"));
person.setUserOtherName(resultSet.getString("userOtherName"));
person.setUserIdentify(resultSet.getInt("userIdentify"));
person.setUserAccount(resultSet.getString("userAccount"));
person.setUserPassword(resultSet.getString("userPassword"));
person.setUserBirthday(resultSet.getString("userBirthday"));
personLsit.add(person);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
}
package com.Dao;
import com.DBUtiles.DBUtils;
import com.bean.Person;
import com.bean.studentTask;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.Dao
* @FileName: registerDaoImpl
* @Author: 峰。
* @Date: 2023/8/24-18:16
* @Version: 1.0
* @Description:
*/
public class registerDaoImpl implements registerDao {
@Override
public int addUser(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
int res = 0;
List<studentTask> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
res = preparedStatement.executeUpdate(sql);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
if (res == 1) {
System.out.println("添加成功");
return res;
} else {
System.out.println("添加失败");
return res;
}
}
}
package com.Dao;
import com.DBUtiles.DBUtils;
import com.bean.Person;
import com.bean.studentTask;
import com.bean.task;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.Dao
* @FileName: StudentDaoImpl
* @Author: 峰。
* @Date: 2023/8/22-20:11
* @Version: 1.0
* @Description:
*/
public class StudentDaoImpl implements StudentDao{
@Override
public List<Person> getStudentList(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<Person> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
Person person = new Person();
person.setUserName(resultSet.getString("userName"));
person.setUserSex(resultSet.getString("userSex"));
person.setUserIdCard(resultSet.getString("userIdCard"));
person.setUserOtherName(resultSet.getString("userOtherName"));
person.setUserIdentify(resultSet.getInt("userIdentify"));
person.setUserAccount(resultSet.getString("userAccount"));
person.setUserPassword(resultSet.getString("userPassword"));
person.setUserBirthday(resultSet.getString("userBirthday"));
personLsit.add(person);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
@Override
public List<task> getAllMyTask(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<task> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
task task = new task();
task.setTask(resultSet.getString("taskAccount"));
task.setTaskDate(resultSet.getString("taskDate"));
task.setTaskName(resultSet.getString("taskName"));
task.setTeacherAccount(resultSet.getString("teacherAccount"));
personLsit.add(task);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
@Override
public List<studentTask> getTaskDetail(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<studentTask> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
studentTask st = new studentTask();
st.setIsFinish(resultSet.getInt("isFinish"));
st.setScore(resultSet.getInt("Score"));
st.setStudentAccount(resultSet.getString("StudentAccount"));
st.setTaskAccount(resultSet.getString("taskAccount"));
st.setStudentName(resultSet.getString("userName"));
st.setStudentAnswer(resultSet.getString("studentAnswer"));
personLsit.add(st);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
@Override
public int upScore(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
int res = 0;
List<studentTask> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
res = preparedStatement.executeUpdate();
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return res;
}
@Override
public List<Person> getMySelf(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<Person> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
Person person = new Person();
person.setUserName(resultSet.getString("userName"));
person.setUserSex(resultSet.getString("userSex"));
person.setUserIdCard(resultSet.getString("userIdCard"));
person.setUserOtherName(resultSet.getString("userOtherName"));
person.setUserIdentify(resultSet.getInt("userIdentify"));
person.setUserAccount(resultSet.getString("userAccount"));
person.setUserPassword(resultSet.getString("userPassword"));
person.setUserBirthday(resultSet.getString("userBirthday"));
personLsit.add(person);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
@Override
public void upAnswer(String sql) {
upScore(sql);
}
@Override
public List<studentTask> getStuTask(String sql) {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<studentTask> personLsit = new ArrayList<>();
try {
connection = DBUtils.getConnection();
preparedStatement = connection.prepareStatement(sql);
resultSet = preparedStatement.executeQuery();
while(resultSet.next()){
studentTask st = new studentTask();
st.setIsFinish(resultSet.getInt("isFinish"));
st.setScore(resultSet.getInt("Score"));
st.setStudentAccount(resultSet.getString("StudentAccount"));
st.setTaskAccount(resultSet.getString("taskAccount"));
st.setStudentAnswer(resultSet.getString("studentAnswer"));
personLsit.add(st);
}
DBUtils.ClearAll(connection,preparedStatement,resultSet);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
return personLsit;
}
}
数据库连接工具:
package com.DBUtiles;
import java.sql.*;
/**
* @BelongsProject: Tab8
* @BelongsPackage: com.JDBCConnect.www
* @FileName: DBUtils
* @Author: 峰。
* @Date: 2023/5/9-23:27
* @Version: 1.0
* @Description: JDBC工具类,两个方法,1)获取连接,2)释放资源
*/
public class DBUtils {
//1)建立连接
public static Connection getConnection() throws ClassNotFoundException, SQLException {
Class.forName("com.mysql.cj.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/db_it1?useSSL=false";
String user = "root";
String password = "wbf";
Connection connection = (Connection) DriverManager.getConnection(url, user, password);
System.out.println("数据库连接成功~");
return connection;
}
//2)释放资源
public static void ClearAll(Connection connection, Statement statement, ResultSet resultSet) throws SQLException {
//空值不能关闭 先开后关
if (resultSet!=null){
resultSet.close();
}
if (statement!=null){
statement.close();
}
if (connection!=null){
connection.close();
}
}
}
业务逻辑层(此处省略了接口):
package com.service;
import com.Dao.commonDao;
import com.Dao.commonDaoImpl;
import com.bean.Person;
import com.bean.studentTask;
import com.bean.task;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.service
* @FileName: commonServiceImpl
* @Author: 峰。
* @Date: 2023/8/26-14:33
* @Version: 1.0
* @Description:
*/
public class commonServiceImpl implements commonService{
commonDao cd = new commonDaoImpl();
@Override
public void deletePerson(String userAccount) {
String sql = "delete from person where userAccount = '"+userAccount+"'";
cd.deletePerson(sql);
}
@Override
public List<Person> getAllTea() {
String sql = "select * from person where userIdentify = 0";
return cd.getAllTea(sql);
}
@Override
public void selectPash(String userAccount, String Account) {
String sql = "insert into userteacher(userAccount,teacherAccount) values('"+Account+"','"+userAccount+"')";
cd.selectTea(sql);
}
@Override
public List<studentTask> selectTaskDetail(String taskAccount) {
String sql = "select * from studenttask where taskAccount = "+taskAccount+"";
return cd.getMyTask(sql);
}
}
package com.service;
import com.Dao.ManageDao;
import com.Dao.ManageDaoImpl;
import com.bean.Person;
import com.bean.task;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.service
* @FileName: ManageServiceImpl
* @Author: 峰。
* @Date: 2023/8/22-20:04
* @Version: 1.0
* @Description:
*/
public class ManageServiceImpl implements ManageService{
ManageDao md = new ManageDaoImpl();
@Override
public List<Person> getAllPerson() {
return md.getAllPerson();
}
@Override
public List<task> getAllTask() {
String sql = "select * from task";
return md.getAllTask(sql);
}
}
package com.service;
import com.Dao.registerDao;
import com.Dao.registerDaoImpl;
import com.bean.Person;
import java.util.Random;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.service
* @FileName: registerServiceImpl
* @Author: 峰。
* @Date: 2023/8/24-18:16
* @Version: 1.0
* @Description:
*/
public class registerServiceImpl implements registerService{
registerDao rd = new registerDaoImpl();
@Override
public int addUser(Person person) {
person.setUserIdCard(RandomIdCard());
String sql = "insert into person (userAccount,userBirthday,userIdCard,userIdentify,userName,userOtherName,userPassword,userSex) \n" +
"values ('"+person.getUserAccount()+"','"+person.getUserBirthday()+"','"+person.getUserIdCard()+"'," +
""+person.getUserIdentify()+",'"+person.getUserName()+"','"+person.getUserOtherName()+"','"+person.getUserPassword()+"'" +
",'"+person.getUserSex()+"')";
return rd.addUser(sql);
}
public String RandomIdCard(){
Random random = new Random();
String idcard = "";
for (int i = 0 ;i<9;i++) {
String randomNumber = String.valueOf(random.nextInt(10));
System.out.println("随机数: " + randomNumber);
idcard = idcard+randomNumber;
}
System.out.println(idcard);
return idcard;
}
}
package com.service;
import com.Dao.StudentDao;
import com.Dao.StudentDaoImpl;
import com.bean.Person;
import com.bean.studentTask;
import com.bean.task;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.service
* @FileName: StudentServiceImpl
* @Author: 峰。
* @Date: 2023/8/22-20:03
* @Version: 1.0
* @Description:
*/
public class StudentServiceImpl implements StudentService{
StudentDao sd = new StudentDaoImpl();
@Override
public List<Person> getAllStudent(String userAccount) {
String sql = "select * from person where userAccount in (select userAccount from userteacher where teacherAccount = '"+userAccount+"')";
return sd.getStudentList(sql);
}
@Override
public List<task> getAllMyTask(String userAccount) {
String sql = "select * from task where teacherAccount = '"+userAccount+"'";
return sd.getAllMyTask(sql);
}
public List<studentTask> getAllStuTask(String userAccount) {
String sql = "select * from studenttask where studentAccount = '"+userAccount+"'";
return sd.getStuTask(sql);
}
@Override
public List<studentTask> getTaskDetail(String taskAccount) {
String sql = "select * from studenttask,person where studenttask.studentAccount=person.userAccount and taskAccount='"+taskAccount+"';";
return sd.getTaskDetail(sql);
}
@Override
public int upScore(int upScore, String taskAccount) {
String sql = "update studenttask set Score = "+upScore+" where taskAccount = '"+taskAccount+"';";
return sd.upScore(sql);
}
@Override
public int DelTask(String taskAccount) {
String sql = "delete from studenttask where taskAccount = '"+taskAccount+"'";
String sql1 = "delete from task where taskAccount = '"+taskAccount+"'";
sd.upScore(sql);
sd.upScore(sql1);
return 0;
}
@Override
public void upName(String upName,String userName) {
String sql = "update person set userName = '"+upName+"' where userAccount = '"+userName+"'";
sd.upScore(sql);
}
@Override
public void upSex(String upSex,String userName) {
String sql = "update person set userSex = '"+upSex+"' where userAccount = '"+userName+"'";
sd.upScore(sql);
}
@Override
public void upBirthday(String upBirthday,String userName) {
String sql = "update person set userBirthday = '"+upBirthday+"' where userAccount = '"+userName+"'";
sd.upScore(sql);
}
@Override
public void upOtherName(String upOtherName,String userName) {
String sql = "update person set userOtherName = '"+upOtherName+"' where userAccount = '"+userName+"'";
sd.upScore(sql);
}
@Override
public List<Person> getMySelf(String userAccount) {
String sql = "select * from person where userAccount = '"+userAccount+"'";
return sd.getMySelf(sql);
}
@Override
public List<Person> getAllPersonn(String userAccount) {
String sql = "select * from person";
return sd.getStudentList(sql);
}
@Override
public void upAnswer(String answer,String taskAccount) {
String sql = "update studenttask set studentAnswer = '"+answer+"' where taskAccount = "+taskAccount+"";
sd.upAnswer(sql);
}
@Override
public List<studentTask> getStuTaskByTask(String taskAccount) {
String sql = "select * from studenttask where taskAccount = '"+taskAccount+"'";
return sd.getStuTask(sql);
}
}
package com.service;
import com.Dao.TestDAO;
import com.bean.Person;
/**
* @BelongsProject: MSTU1
* @BelongsPackage: com.service
* @FileName: UserLoginServiceImpl
* @Author: 峰。
* @Date: 2023/8/21-20:13
* @Version: 1.0
* @Description:
*/
public class UserLoginServiceImpl implements UserLoginService{
@Override
public Person getLogin(Person person) {
Person person1 = TestDAO.Login(person);
return person1;
}
}
Servlet包:文章来源地址https://www.toymoban.com/news/detail-764380.html
package com.stu;
import com.bean.Person;
import com.bean.studentTask;
import com.bean.task;
import com.service.StudentService;
import com.service.StudentServiceImpl;
import com.service.commonService;
import com.service.commonServiceImpl;
import javafx.concurrent.Task;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.stu
* @FileName: CommonServlet
* @Author: 峰。
* @Date: 2023/8/22-19:51
* @Version: 1.0
* @Description:
*/
@WebServlet("/common.action")
public class CommonServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
String action = req.getParameter("action");
commonService sc = new commonServiceImpl();
StudentService ss = new StudentServiceImpl();
if (action.equals("index")){
//转跳到首页
req.setAttribute("mainRight","blank.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("myThing")) {
Person p = (Person) req.getSession().getAttribute("session_person");
List<Person> personList= new ArrayList<>();
personList.add(p);
req.setAttribute("arr",personList);
req.setAttribute("mainRight","SelfThing.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("deletePerson")) {
List<Person> personList = new ArrayList<>();
String userAccount = req.getParameter("personAccount");
sc.deletePerson(userAccount);
Person session_person = (Person) req.getSession().getAttribute("session_person");
if (session_person.getUserIdentify() == 0){
personList = ss.getAllStudent(session_person.getUserAccount());
} else if (session_person.getUserIdentify() == 2) {
personList = ss.getAllPersonn(session_person.getUserAccount());
}
//获取学生列表
for (Person p:personList){
System.out.println(p.toString());
}
req.setAttribute("arr",personList);
req.setAttribute("mainRight","person.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upStudent")) {
String studentAccount = req.getParameter("student");
List<Person> personList = ss.getMySelf(studentAccount);
//获取学生列表
for (Person p:personList){
System.out.println(p.toString());
}
req.setAttribute("arr",personList);
req.setAttribute("mainRight","upPerson.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upPersonName")) {
String upName = req.getParameter("userName");
String userAccount = req.getParameter("userAccount");
ss.upName(upName,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upPerson.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}else if (action.equals("upPersonSex")) {
String upSex = req.getParameter("userSex");
String userAccount = req.getParameter("userAccount");
ss.upSex(upSex,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upPerson.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}else if (action.equals("upPersonBirthday")) {
String upBirthday = req.getParameter("userBirthday");
String userAccount = req.getParameter("userAccount");
ss.upBirthday(upBirthday,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upPerson.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}else if (action.equals("upPersonOtherName")) {
String upOtherName = req.getParameter("OtherName");
String userAccount = req.getParameter("userAccount");
ss.upOtherName(upOtherName,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upPerson.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("list")) {
Person session_person = (Person) req.getSession().getAttribute("session_person");
List<Person> personList = ss.getAllPersonn(session_person.getUserAccount());
//获取学生列表
for (Person p:personList){
System.out.println(p.toString());
}
req.setAttribute("arr",personList);
req.setAttribute("mainRight","person.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("selectTeacher")) {
Person session_person = (Person) req.getSession().getAttribute("session_person");
List<Person> teaList = sc.getAllTea();
for (Person p:teaList){
System.out.println(p.toString());
}
req.setAttribute("arr",teaList);
req.setAttribute("mainRight","teaList.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("MyTask")) {
Person session_person = (Person) req.getSession().getAttribute("session_person");
String userAccount = session_person.getUserAccount();
List<studentTask> allMyTask = ss.getAllStuTask(userAccount);
for (studentTask t:allMyTask){
System.out.println(t.toString());
}
req.setAttribute("arr",allMyTask);
req.setAttribute("mainRight","taskDetail.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("selectPash")) {
Person session_person = (Person) req.getSession().getAttribute("session_person");
String userAccount = req.getParameter("userAccount");
sc.selectPash(userAccount,session_person.getUserAccount());
req.setAttribute("mainRight","blank.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("goSkimDetail")) {
String taskAccount = req.getParameter("taskAccount");
List<studentTask> tasks = sc.selectTaskDetail(taskAccount);
req.getSession().setAttribute("task",tasks.get(0));
req.setAttribute("arr",tasks);
req.setAttribute("mainRight","taskDetail.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upAnswer")) {
String taskAccount = req.getParameter("taskAccount");
List<studentTask> tasks = ss.getStuTaskByTask(taskAccount);
req.setAttribute("arr",tasks);
req.setAttribute("mainRight","upAnswer.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("answer")) {
String answer = req.getParameter("answer");
String taskAccount = req.getParameter("taskAccount");
ss.upAnswer(answer,taskAccount);
List<studentTask> tasks = ss.getStuTaskByTask(taskAccount);
req.getSession().setAttribute("task",tasks.get(0));
req.setAttribute("arr",tasks);
req.setAttribute("mainRight","taskDetail.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}
}
}
package com.stu;
import com.bean.Person;
import com.bean.task;
import com.service.ManageService;
import com.service.ManageServiceImpl;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.stu
* @FileName: ManageServlet
* @Author: 峰。
* @Date: 2023/8/22-20:00
* @Version: 1.0
* @Description:
*/
@WebServlet("/man.action")
public class ManageServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
String action = req.getParameter("action");
ManageService ms = new ManageServiceImpl();
if (action.equals("list")){
List<Person> personList = ms.getAllPerson();
for (Person p :personList){
System.out.println(p.toString());
}
req.setAttribute("arr",personList);
req.setAttribute("mainRight","person.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}else if (action.equals("myThing")) {
Person p = (Person) req.getSession().getAttribute("session_person");
List<Person> personList= new ArrayList<>();
personList.add(p);
req.setAttribute("arr",personList);
req.setAttribute("mainRight","SelfThing.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("taskList")) {
Person p = (Person) req.getSession().getAttribute("session_person");
List<task> taskList = ms.getAllTask();
for (task t:taskList){
System.out.println(t.toString());
}
req.setAttribute("arr",taskList);
req.setAttribute("mainRight","task.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}
}
}
package com.stu;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.stu
* @FileName: OutLoginServlet
* @Author: 峰。
* @Date: 2023/8/22-21:18
* @Version: 1.0
* @Description:
*/
@WebServlet("/outLogin")
public class OutLoginServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getSession().getAttribute("session_person");
HttpSession session = req.getSession();
session.removeAttribute("session_person");
req.getRequestDispatcher("UserLogin.jsp").forward(req,resp);
}
}
package com.stu;
import com.bean.Person;
import com.service.registerService;
import com.service.registerServiceImpl;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.stu
* @FileName: regServlet
* @Author: 峰。
* @Date: 2023/8/24-18:11
* @Version: 1.0
* @Description:
*/
@WebServlet("/regServlet")
public class regServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
registerService rs = new registerServiceImpl();
Person person = new Person();
person.setUserAccount(req.getParameter("userAccount"));
person.setUserPassword(req.getParameter("userPassword"));
person.setUserBirthday(req.getParameter("userBirthday"));
person.setUserIdentify(1);
person.setUserName(req.getParameter("userName"));
person.setUserSex(req.getParameter("userSex"));
person.setUserOtherName(req.getParameter("userOtherName"));
System.out.println(person.toString());
int bool = rs.addUser(person);
if (bool == 1){
req.getRequestDispatcher("UserLogin.jsp").forward(req,resp);
}else {
req.setAttribute("registerFalse","注册失败");
req.getRequestDispatcher("UserLogin.jsp").forward(req,resp);
}
}
}
package com.stu;
import com.bean.Person;
import com.bean.studentTask;
import com.bean.task;
import com.service.StudentService;
import com.service.StudentServiceImpl;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @BelongsProject: MUST3
* @BelongsPackage: com.stu
* @FileName: TeacherServlet
* @Author: 峰。
* @Date: 2023/8/22-19:59
* @Version: 1.0
* @Description:
*/
@WebServlet("/tea.action")
public class TeacherServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("UTF-8");
String action = req.getParameter("action");
StudentService ss = new StudentServiceImpl();
// Person session_person = (Person) req.getAttribute("session_person");直接获取拿不到person对象,需要通过session获取
Person session_person = (Person) req.getSession().getAttribute("session_person");
if (action.equals("list")){
List<Person> personList = ss.getAllStudent(session_person.getUserAccount());
//获取学生列表
for (Person p:personList){
System.out.println(p.toString());
}
req.setAttribute("arr",personList);
req.setAttribute("mainRight","person.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("goMyTask")) {
List<task> taskList = ss.getAllMyTask(session_person.getUserAccount());
for (task t:taskList){
System.out.println(t.toString());
}
req.setAttribute("arr",taskList);
req.setAttribute("mainRight","task.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("goSkimDetail")) {
//查看任务
String taskAccount = req.getParameter("taskAccount");
List<studentTask> taskList= ss.getTaskDetail(taskAccount);
req.setAttribute("arr",taskList);
req.setAttribute("mainRight","studentTask.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("myThing")) {
List<Person> personList = ss.getMySelf(session_person.getUserAccount());
req.setAttribute("arr",personList);
req.setAttribute("mainRight","SelfThing.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upScoree")) {
String taskAccount = req.getParameter("taskAccount");
int upScore = Integer.parseInt(req.getParameter("Score"));
int res = ss.upScore(upScore,taskAccount);
if (res == 1){
List<studentTask> taskList= ss.getTaskDetail(taskAccount);
req.setAttribute("arr",taskList);
req.setAttribute("mainRight","studentTask.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}
} else if (action.equals("upScore")) {
String taskAccount = req.getParameter("taskAccount");
List<studentTask> taskList= ss.getTaskDetail(taskAccount);
req.setAttribute("arr",taskList);
req.setAttribute("mainRight","upScore.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("Del")) {
String taskAccount = req.getParameter("taskAccount");
int res = ss.DelTask(taskAccount);
List<task> taskList = ss.getAllMyTask(session_person.getUserAccount());
for (task t : taskList) {
System.out.println(t.toString());
}
req.setAttribute("arr", taskList);
req.setAttribute("mainRight", "task.jsp");
req.getRequestDispatcher("main.jsp").forward(req, resp);
} else if (action.equals("upSelf")) {
Person p = (Person) req.getSession().getAttribute("session_person");
List<Person> personList= new ArrayList<>();
personList.add(p);
req.setAttribute("arr",personList);
req.setAttribute("mainRight","upSelf.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upSelfName")) {
System.out.println("111");
String upName = req.getParameter("userName");
String userAccount = req.getParameter("userAccount");
System.out.println(upName);
ss.upName(upName,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upSelf.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upSelfSex")) {
String upSex = req.getParameter("userSex");
String userAccount = req.getParameter("userAccount");
ss.upSex(upSex,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upSelf.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
} else if (action.equals("upSelfBirthday")) {
String upBirthday = req.getParameter("userBirthday");
String userAccount = req.getParameter("userAccount");
ss.upBirthday(upBirthday,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upSelf.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}else if (action.equals("upSelfOtherName")){
String upOtherName = req.getParameter("OtherName");
String userAccount = req.getParameter("userAccount");
ss.upOtherName(upOtherName,userAccount);
List<Person> p = ss.getMySelf(userAccount);
req.setAttribute("arr",p);
req.setAttribute("mainRight","upSelf.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}
}
}
package com.stu;
import com.Dao.TestDAO;
import com.bean.Person;
import com.service.UserLoginService;
import com.service.UserLoginServiceImpl;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @BelongsProject: MSTU1
* @BelongsPackage: com.stu
* @FileName: UserLoginServlet
* @Author: 峰。
* @Date: 2023/8/20-19:25
* @Version: 1.0
* @Description:
*/
@WebServlet("/UserLogin")
public class UserLoginServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// System.out.println("进来了");
//1.拿到前端传递过来的信息,比方说用户名和密码
String username = req.getParameter("userAccount");
String password = req.getParameter("userPassword");
Person person = new Person(username,password);
// Person person1 = TestDAO.Login(person);
UserLoginService uls = new UserLoginServiceImpl();
Person person1 = uls.getLogin(person);
// if (username.equals("admin") && password.equals("word")){
if (username.equals(person1.getUserAccount())&&password.equals(person1.getUserPassword())){
// 进入主页面
System.out.println(person1);
req.getSession().setAttribute("session_person",person1);//默认保存30分钟
// req.setAttribute("person",person1);
req.setAttribute("mainRight","blank.jsp");
req.getRequestDispatcher("main.jsp").forward(req,resp);
}else {
// 否则,跳回登录界面
req.setAttribute("tip","账户密码错误");
req.getRequestDispatcher("UserLogin.jsp").forward(req,resp);//转跳回界面
}
}
}
数据库连接信息:
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/db_it1
user=root
password=wbf
静态页面(其中用到的一些图片需要自己提供):
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/21
Time: 19:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
#content{
width: 1300px;
height: 800px;
/*border: 1px solid red;*/
float: right;
color: grey;
font-size: 50px;
/*margin-right: 40px;*/
/*margin-left: 260px;*/
/*margin-top: 150px;*/
}
</style>
</head>
<body >
<div id="content">
欢迎来到此系统
</div>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 15:19
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">任务账户</td>
<td class="lf">任务名称</td>
<td class="lf">任务时间</td>
<td class="lf">查看详细</td>
<%-- <td>删除</td>--%>
<%-- <td>修改</td>--%>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="task">
<td class="lf">${task.getTask()}</td>
<td class="lf">${task.getTaskName()}</td>
<td class="lf">${task.getTaskDate()}</td>
<td class="lf"><img style="width: 73px;height: 44px" src="xiangqing.png" onclick="skimDetail(${task.getTask()})"></td>
<%-- <td class="lf">${person.getUserIdCard()}</td>--%>
<%-- <td class="lf">--%>
<%-- <c:if test="${person.getUserIdentify()==0}">学生</c:if>--%>
<%-- <c:if test="${person.getUserIdentify()==1}">老师</c:if>--%>
<%-- </td>--%>
<%-- <td class="lf">${person.getUserOtherName()}</td>--%>
<%-- <td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>--%>
<%-- <td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>--%>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function skimDetail(taskAccount){
//查看学生任务完成情况
window.location.href = "common.action?action=goSkimDetail&taskAccount="+taskAccount;
}
</script>
<%--<script>--%>
<%-- function deleteThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%-- function upThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%--</script>--%>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/18
Time: 13:46
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
<script>
window.location.href = "UserLogin.jsp";
</script>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/20
Time: 21:39
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
#BigBodyFrame{
width: 1500px;
height: 120px;
/*margin-left:200px;*/
border: grey 1px solid;
background-image: url("VCG211448478478.jpg");
}
#daohang{
width: 200px;
height: 320px;
border: grey 1px solid;
float: left;
}
#file{
width: 180px;
height: 50px;
margin-left: 10px;
margin-top: 10px;
border: grey 1px solid;
background-color: antiquewhite;
}
a{
color: black;
font-size: 26px;
margin-left: 15px;
margin-top: 15px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<link href="${pageContext.request.contextPath}/css/table.css" rel="stylesheet" media="screen">
</head>
<body>
<div id="BigBodyFrame"></div>
<br>
<br>
<span style="float: right; margin-right: 100px; color: grey">当前用户:${session_person.userName}</span>
<%-- <a href="#">修改密码</a>--%>
<br>
<div id="daohang">
<c:if test="${session_person.getUserIdentify()==0}">
<li id="file"><a href="common.action?action=index">查看首页</a></li>
<%-- 回到首页的动作--%>
<li id="file"><a href="tea.action?action=list">学生管理</a></li>
<li id="file"><a href="tea.action?action=goMyTask">任务管理</a></li>
<li id="file"><a href="tea.action?action=myThing">我的信息</a></li>
<li id="file"><a href="outLogin">退出系统</a></li>
</c:if>
<c:if test="${session_person.getUserIdentify()==1}">
<li id="file"><a href="common.action?action=index">查看首页</a></li>
<li id="file"><a href="common.action?action=selectTeacher">选择老师</a></li>
<li id="file"><a href="common.action?action=MyTask">我的任务</a></li>
<li id="file"><a href="common.action?action=myThing">我的信息</a></li>
<li id="file"><a href="outLogin">退出系统</a></li>
</c:if>
<c:if test="${session_person.getUserIdentify()==2}">
<li id="file"><a href="common.action?action=index">查看首页</a></li>
<li id="file"><a href="man.action?action=list">人员管理</a></li>
<li id="file"><a href="man.action?action=taskList">任务管理</a></li>
<li id="file"><a href="man.action?action=myThing">我的信息</a></li>
<li id="file"><a href="outLogin">退出系统</a></li>
</c:if>
<%-- <div id="file" onclick="clickThis()"></div>--%>
</div>
<jsp:include page="${mainRight = null?'blank.jsp':mainRight}"></jsp:include>
<%--<jsp:include page="${downJSP = null ;downJSP}"></jsp:include>--%>
<%--mainRight是从后端传过来的数据值--%>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/22
Time: 19:57
To change this template use File | Settings | File Templates.
--%>
<%--
Created by IntelliJ IDEA.
User: 30890
Date: 2023/4/17
Time: 9:47
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">账户</td>
<td class="lf">姓名</td>
<td class="lf">性别</td>
<td class="lf">生日</td>
<td class="lf">身份证号码</td>
<td class="lf">角色</td>
<td class="lf">其他名称</td>
<td class="lf">删除</td>
<td class="lf">修改</td>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="person">
<td class="lf">${person.getUserAccount()}</td>
<td class="lf">${person.getUserName()}</td>
<td class="lf">${person.getUserSex()}</td>
<td class="lf">${person.getUserBirthday()}</td>
<td class="lf">${person.getUserIdCard()}</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==0}">老师</c:if>
<c:if test="${person.getUserIdentify()==1}">学生</c:if>
<c:if test="${person.getUserIdentify()==2}">管理员</c:if>
</td>
<td class="lf">${person.getUserOtherName()}</td>
<td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>
<td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function deleteThis(userAccount){
// alert("userAccount");
window.location.href="common.action?action=deletePerson&personAccount="+userAccount;
}
function upThis(userAccount){
window.location.href="common.action?action=upStudent&student="+userAccount;
}
</script>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/24
Time: 17:48
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>注册界面</title>
<style>
#outerLoginFrame{
width: 500px;
height: 600px;
margin-left: 500px;
margin-top: 120px;
border: white 0px solid;
}
#innerLoginFrame{
width: 360px;
/*border: grey 2px solid;*/
margin-left: 80px;
margin-top: 50px;
height: 250px;
color: grey;
font-size: 25px;
}
input{
width: 220px;
height: 30px;
}
</style>
</head>
<body>
<div id="outerLoginFrame" style="border:grey 2px solid">
<%-- <span style="position: center"></span>--%>
<h1 style="margin-top: 40px;margin-left: 160px;color: grey">注 册 账 号</h1>
<div id="innerLoginFrame">
<form action="regServlet" method="post" onclick=" return checkRegister()">
账户:<input type="text" id="userAccount" name="userAccount" class="myText"><br><br>
姓名:<input type="text" id="userName" name="userName" class="myText"><br><br>
密码:<input type="password" id="userPassword" name="userPassword" class="myText"><br><br>
性别:<input type="text" id="userSex" name="userSex" class="myText"><br><br>
生日:<input type="text" id="userBirthday" name="userBirthday" class="myText"><br><br>
别称:<input type="text" id="userOtherName" name="userOtherName" class="myText"><br><br>
<input type="submit" style="width: 140px ;margin-left :60px" value="注册">
<br>
<span style="color:red; font-size: 5px; margin-left: 90px" id="tip" ></span>
</form>
</div>
</div>
</body>
</html>
<script>
<%-- 方法--%>
function checkRegister(){
// alert("进来") 弹窗
let userAccount = document.getElementById("userAccount").value;
let userPassword = document.getElementById("userPassword").value;
let userName = document.getElementById("userName").value;
let userSex = document.getElementById("userSex").value;
let userBirthday = document.getElementById("userBirthday").value;
let userOtherName = document.getElementById("userOtherName").value;
if (userAccount == null || userAccount.trim()==""){
// alert("账户不能为空");
document.getElementById("tip").innerHTML = "账户不能为空";
return false;
}
else if (userPassword == null || userPassword.trim()==""){
// alert("密码不能为空");
document.getElementById("tip").innerHTML = "密码不能为空";
return false;
} else if (userName == null || userName.trim()==""){
// alert("密码不能为空");
document.getElementById("tip").innerHTML = "请输入名称";
return false;
} else if (userSex == null || userSex.trim()==""){
// alert("密码不能为空");
document.getElementById("tip").innerHTML = "请填写性别!";
return false;
} else if (userBirthday == null || userBirthday.trim()==""){
// alert("密码不能为空");
document.getElementById("tip").innerHTML = "请填写生日日期!";
return false;
}else if (userOtherName == null || userOtherName.trim()==""){
// alert("密码不能为空");
document.getElementById("tip").innerHTML = "请填写别称!";
return false;
}
}
</script>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 18:37
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">账户</td>
<td class="lf">姓名</td>
<td class="lf">性别</td>
<td class="lf">生日</td>
<td class="lf">身份证号码</td>
<td class="lf">角色</td>
<td class="lf">其他名称</td>
<td class="lf">修改</td>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="person">
<td class="lf">${person.getUserAccount()}</td>
<td class="lf">${person.getUserName()}</td>
<td class="lf">${person.getUserSex()}</td>
<td class="lf">${person.getUserBirthday()}</td>
<td class="lf">${person.getUserIdCard()}</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==1}">学生</c:if>
<c:if test="${person.getUserIdentify()==0}">老师</c:if>
<c:if test="${person.getUserIdentify()==2}">管理员</c:if>
</td>
<td class="lf">${person.getUserOtherName()}</td>
<td class="lf"><img style="width: 83px;height: 44px" src="xiugai.png" onclick="upThis(${person.getUserIdentify()})"> </td>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
<script>
function upThis(Identify){
// window.location.href="tea.action?action=upSelf&userAccount="+userAccount;
// alert(userAccount)
if (Identify == 0){
window.location.href="tea.action?action=upSelf";
}
if (Identify == 1){
window.location.href="tea.action?action=upSelf";
}
if (Identify == 2){
window.location.href="tea.action?action=upSelf";
}
}
</script>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 17:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">任务</td>
<td class="lf">学生账户</td>
<td class="lf">学生姓名</td>
<td class="lf">学生答案</td>
<td class="lf">是否完成</td>
<td class="lf">分数</td>
<td class="lf">修改分数</td>
<td>删除</td>
<%-- <td>查看评论</td>--%>
<%-- <td>删除</td>--%>
<%-- <td>修改</td>--%>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="taskDetail">
<td class="lf">${taskDetail.getTaskAccount()}</td>
<td class="lf">${taskDetail.getStudentAccount()}</td>
<td class="lf">${taskDetail.getStudentName()}</td>
<td class="lf">${taskDetail.getStudentAnswer()}</td>
<td class="lf">
<c:if test="${taskDetail.getIsFinish()==0}"><span style="color: red">未完成</span></c:if>
<c:if test="${taskDetail.getIsFinish()==1}"><span style="color: aqua">已完成</span></c:if>
</td>
<td class="lf">${taskDetail.getScore()}</td>
<td class="lf"><img style="width: 83px;height: 44px" src="xiugai.png" onclick="upScore(${taskDetail.getTaskAccount()})"> </td>
<td><img style="width: 83px;height: 44px" src="shanchu.png"
onclick="Del(${taskDetail.getTaskAccount()})"></td>
<%-- <td class="lf">${person.getUserIdCard()}</td>--%>
<%-- <td class="lf">--%>
<%-- <c:if test="${person.getUserIdentify()==0}">学生</c:if>--%>
<%-- <c:if test="${person.getUserIdentify()==1}">老师</c:if>--%>
<%-- </td>--%>
<%-- <td class="lf">${person.getUserOtherName()}</td>--%>
<%-- <td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>--%>
<%-- <td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>--%>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function upScore(taskAccount){
window.location.href="tea.action?action=upScore&taskAccount="+taskAccount;
}
function Del(taskAccount){
window.location.href="tea.action?action=Del&taskAccount="+taskAccount;
}
</script>
<%--<script>--%>
<%-- function skimDetail(taskAccount){--%>
<%-- //查看学生任务完成情况--%>
<%-- window.location.href = "tea.action?action=goSkimDetail&taskAccount="+taskAccount;--%>
<%-- }--%>
<%--</script>--%>
<%--<script>--%>
<%-- function deleteThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%-- function upThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%--</script>--%>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 15:19
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">任务账户</td>
<td class="lf">任务名称</td>
<td class="lf">任务时间</td>
<td class="lf">查看详细</td>
<%-- <td>删除</td>--%>
<%-- <td>修改</td>--%>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="task">
<td class="lf">${task.getTask()}</td>
<td class="lf">${task.getTaskName()}</td>
<td class="lf">${task.getTaskDate()}</td>
<td class="lf"><img style="width: 73px;height: 44px" src="xiangqing.png" onclick="skimDetail(${task.getTask()})"></td>
<%-- <td class="lf">${person.getUserIdCard()}</td>--%>
<%-- <td class="lf">--%>
<%-- <c:if test="${person.getUserIdentify()==0}">学生</c:if>--%>
<%-- <c:if test="${person.getUserIdentify()==1}">老师</c:if>--%>
<%-- </td>--%>
<%-- <td class="lf">${person.getUserOtherName()}</td>--%>
<%-- <td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>--%>
<%-- <td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>--%>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function skimDetail(taskAccount){
//查看学生任务完成情况
window.location.href = "tea.action?action=goSkimDetail&taskAccount="+taskAccount;
}
</script>
<%--<script>--%>
<%-- function deleteThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%-- function upThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%--</script>--%>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 17:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">任务</td>
<%-- <td class="lf">学生账户</td>--%>
<%-- <td class="lf">学生姓名</td>--%>
<td class="lf">学生答案</td>
<td class="lf">是否完成</td>
<td class="lf">分数</td>
<td class="lf">修改</td>
<%-- <td>查看评论</td>--%>
<%-- <td>删除</td>--%>
<%-- <td>修改</td>--%>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="taskDetail">
<td class="lf">${taskDetail.getTaskAccount()}</td>
<%-- <td class="lf">${taskDetail.getStudentAccount()}</td>--%>
<%-- <td class="lf">${taskDetail.getStudentName()}</td>--%>
<td class="lf">${taskDetail.getStudentAnswer()}</td>
<td class="lf">
<c:if test="${taskDetail.getIsFinish()==0}"><span style="color: red">未完成</span></c:if>
<c:if test="${taskDetail.getIsFinish()==1}"><span style="color: aqua">已完成</span></c:if>
</td>
<td class="lf">${taskDetail.getScore()}</td>
<td class="lf"><img style="width: 83px;height: 44px" src="xiugai.png" onclick="upAnswer(${taskDetail.getTaskAccount()})"> </td>
<%-- <td class="lf">${person.getUserIdCard()}</td>--%>
<%-- <td class="lf">--%>
<%-- <c:if test="${person.getUserIdentify()==0}">学生</c:if>--%>
<%-- <c:if test="${person.getUserIdentify()==1}">老师</c:if>--%>
<%-- </td>--%>
<%-- <td class="lf">${person.getUserOtherName()}</td>--%>
<%-- <td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>--%>
<%-- <td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>--%>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function upAnswer(taskAccount){
window.location.href="common.action?action=upAnswer&taskAccount="+taskAccount;
}
</script>
<%--<script>--%>
<%-- function skimDetail(taskAccount){--%>
<%-- //查看学生任务完成情况--%>
<%-- window.location.href = "tea.action?action=goSkimDetail&taskAccount="+taskAccount;--%>
<%-- }--%>
<%--</script>--%>
<%--<script>--%>
<%-- function deleteThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%-- function upThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%--</script>--%>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/22
Time: 19:57
To change this template use File | Settings | File Templates.
--%>
<%--
Created by IntelliJ IDEA.
User: 30890
Date: 2023/4/17
Time: 9:47
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">姓名</td>
<td class="lf">性别</td>
<td class="lf">角色</td>
<td class="lf">其他名称</td>
<td class="lf">选择</td>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="person">
<td class="lf">${person.getUserName()}</td>
<td class="lf">${person.getUserSex()}</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==0}">老师</c:if>
<c:if test="${person.getUserIdentify()==1}">学生</c:if>
<c:if test="${person.getUserIdentify()==2}">管理员</c:if>
</td>
<td class="lf">${person.getUserOtherName()}</td>
<td ><img style="width: 73px;height: 44px" src="xuanze.png" onclick="selectThis('${person.getUserAccount()}')"> </td>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function selectThis(userAccount){
window.location.href="common.action?action=selectPash&userAccount="+userAccount;
}
</script>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 17:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">任务</td>
<%-- <td class="lf">学生账户</td>--%>
<%-- <td class="lf">学生姓名</td>--%>
<td class="lf">学生答案</td>
<td class="lf">是否完成</td>
<td class="lf">分数</td>
<td class="lf">修改</td>
<%-- <td>查看评论</td>--%>
<%-- <td>删除</td>--%>
<%-- <td>修改</td>--%>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="taskDetail">
<td class="lf">${taskDetail.getTaskAccount()}</td>
<%-- <td class="lf">${taskDetail.getStudentAccount()}</td>--%>
<%-- <td class="lf">${taskDetail.getStudentName()}</td>--%>
<td class="lf"> <form action="common.action?action=answer&taskAccount=${taskDetail.getTaskAccount()}" method="post">
<input placeholder="${taskDetail.getStudentAnswer()}" type="text" id="answer" name="answer" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return answerPash()" value="提交">
<span style="color:red; font-size: 5px" id="tip" ></span>
</form></td>
<td class="lf">
<c:if test="${taskDetail.getIsFinish()==0}"><span style="color: red">未完成</span></c:if>
<c:if test="${taskDetail.getIsFinish()==1}"><span style="color: aqua">已完成</span></c:if>
</td>
<td class="lf">${taskDetail.getScore()}</td>
<td class="lf"><img style="width: 83px;height: 44px" src="xiugai.png" onclick="upAnswer(${taskDetail.getTaskAccount()})"> </td>
<%-- <td class="lf">${person.getUserIdCard()}</td>--%>
<%-- <td class="lf">--%>
<%-- <c:if test="${person.getUserIdentify()==0}">学生</c:if>--%>
<%-- <c:if test="${person.getUserIdentify()==1}">老师</c:if>--%>
<%-- </td>--%>
<%-- <td class="lf">${person.getUserOtherName()}</td>--%>
<%-- <td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>--%>
<%-- <td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>--%>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function upAnswer(taskAccount){
let answer = document.getElementById("answer").value;
if (answer == null || answer.trim()==""){
alert("请正确输入!!");
return false;
}
}
</script>
<%--<script>--%>
<%-- function skimDetail(taskAccount){--%>
<%-- //查看学生任务完成情况--%>
<%-- window.location.href = "tea.action?action=goSkimDetail&taskAccount="+taskAccount;--%>
<%-- }--%>
<%--</script>--%>
<%--<script>--%>
<%-- function deleteThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%-- function upThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%--</script>--%>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">账户</td>
<td class="lf">姓名</td>
<td class="lf">性别</td>
<td class="lf">生日</td>
<td class="lf">身份证号码</td>
<td class="lf">角色</td>
<td class="lf">其他名称</td>
<td class="lf">提交</td>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="person">
<td class="lf">${person.getUserAccount()}</td>
<td class="lf">
<form action="common.action?action=upPersonName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserName()}" type="text" name="userName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisName()" value="提交">
</form>
<td class="lf">
<form action="common.action?action=upPersonSex&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserSex()}" type="text" name="userSex" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisSex()" value="提交">
</form>
</td>
<td class="lf">
<form action="common.action?action=upPersonBirthday&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserBirthday()}" type="text" name="userBirthday" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisBirthday(${person.getUserIdentify()})" value="提交">
</form>
</td>
<td class="lf">${person.getUserIdCard()}</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==1}">学生</c:if>
<c:if test="${person.getUserIdentify()==0}">老师</c:if>
</td>
<td class="lf">
<form action="common.action?action=upPersonOtherName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserOtherName()}" type="text" name="OtherName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisOtherName(${person.getUserIdentify()})" value="提交">
</form>
</td>
<td ><img style="width: 73px;height: 44px" src="tijiao.png" onclick="upThis(${person.getUserIdentify()})"> </td>
</tr>
</c:forEach>
<span style="color:red; font-size: 5px" id="tip" ></span>
</tr>
</tbody>
</table>
<script>
function upThis(Identify){
window.location.href="common.action?action=list";
}
function upThisName(){
let userName = document.getElementById("userName").value;
if (userName == null || userName.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfName";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfName";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfName";
// }
}
function upThisSex(){
let userSex = document.getElementById("userSex").value;
if (userSex == null || userSex.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfSex";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfSex";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfSex";
// }
}
function upThisBirthday(){
let userBirthday = document.getElementById("userBirthday").value;
if (userBirthday == null || userBirthday.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfBirthday";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfBirthday";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfBirthday";
// }
}
function upThisOtherName(){
let userOtherName = document.getElementById("userOtherName").value;
if (userOtherName == null || userOtherName.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfOtherName";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfOtherName";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfOtherName";
// }
}
</script>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/23
Time: 17:14
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">任务</td>
<td class="lf">学生账户</td>
<td class="lf">学生姓名</td>
<td class="lf">学生答案</td>
<td class="lf">是否完成</td>
<td class="lf">分数</td>
<td class="lf">修改分数</td>
<td>删除</td>
<%-- <td>查看评论</td>--%>
<%-- <td>删除</td>--%>
<%-- <td>修改</td>--%>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="taskDetail">
<td class="lf">${taskDetail.getTaskAccount()}</td>
<td class="lf">${taskDetail.getStudentAccount()}</td>
<td class="lf">${taskDetail.getStudentName()}</td>
<td class="lf">${taskDetail.getStudentAnswer()}</td>
<td class="lf">
<c:if test="${taskDetail.getIsFinish()==0}"><span style="color: red">未完成</span></c:if>
<c:if test="${taskDetail.getIsFinish()==1}"><span style="color: aqua">已完成</span></c:if>
</td>
<%-- <td class="lf">${taskDetail.getScore()}</td>--%>
<td class="lf">
<form action="tea.action?action=upScoree&taskAccount=${taskDetail.getTaskAccount()}" method="post">
<input placeholder="${taskDetail.getScore()}" type="text" id="Score" name="Score" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upScoree()" value="提交">
<span style="color:red; font-size: 5px" id="tip" ></span>
</form>
</td>
<td class="lf"><img style="width: 83px;height: 44px" src="xiugai.png" onclick="upScore(${taskDetail.getStudentAccount()})"> </td>
<td><img style="width: 83px;height: 44px" src="shanchu.png"
onclick="delete(${taskDetail.getTaskAccount()})"></td>
<%-- <td class="lf">${person.getUserIdCard()}</td>--%>
<%-- <td class="lf">--%>
<%-- <c:if test="${person.getUserIdentify()==0}">学生</c:if>--%>
<%-- <c:if test="${person.getUserIdentify()==1}">老师</c:if>--%>
<%-- </td>--%>
<%-- <td class="lf">${person.getUserOtherName()}</td>--%>
<%-- <td ><img style="width: 73px;height: 44px" onclick="deleteThis('${person.getUserAccount()}')" src="shanchu.png"> </td>--%>
<%-- <td ><img style="width: 73px;height: 44px" src="xiugai.png" onclick="upThis('${person.getUserAccount()}')"> </td>--%>
</tr>
</c:forEach>
</tr>
</tbody>
</table>
</body>
<script>
function upScoree(){
let Score = document.getElementById("Score").value;
if (Score == null || Score.trim()==""){
// alert("账户不能为空");
document.getElementById("tip").innerHTML = "请输入分数";
return false;
}
}
</script>
<%--<script>--%>
<%-- function skimDetail(taskAccount){--%>
<%-- //查看学生任务完成情况--%>
<%-- window.location.href = "tea.action?action=goSkimDetail&taskAccount="+taskAccount;--%>
<%-- }--%>
<%--</script>--%>
<%--<script>--%>
<%-- function deleteThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%-- function upThis(userAccount){--%>
<%-- alert(userAccount);--%>
<%-- }--%>
<%--</script>--%>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<style>
table{
width: 1200px;
}
tr,td{
border: grey 1px ;
}
td{
height: 40px;
}
table td{
height: 60px;
vertical-align: middle!important; /*设置文字垂直居中*/
text-align: center;
}
tr,td{border-right:1px solid #888;border-bottom:1px solid #888;padding:5px 15px;}
th{font-weight:bold;background:#ccc;}
.con-b .row .lf{
width: 15%;
text-align: center;
padding: 10px;
}
.con-b .row .rg{
width: 85%;
}
.con-b tr:nth-of-type(odd){
background-color: #f2f2f2;
}
#ee{
width: 73px;
height: 44px;
}
</style>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
</head>
<body>
<table border="1" cellspacing="0" align="center" class="con-b">
<thead>
<tr class="row" style="color: black;font-size: 25px" >
<td class="lf">账户</td>
<td class="lf">姓名</td>
<td class="lf">性别</td>
<td class="lf">生日</td>
<td class="lf">身份证号码</td>
<td class="lf">角色</td>
<td class="lf">其他名称</td>
<td class="lf">提交</td>
</tr>
</thead>
<tbody>
<tr>
<c:forEach items="${arr}" var="person">
<td class="lf">${person.getUserAccount()}</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==0}"> <form action="tea.action?action=upSelfName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserName()}" type="text" name="userName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisName()" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==1}"> <form action="common.action?action=upSelfName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserName()}" type="text" name="userName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisName()" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==2}"> <form action="man.action?action=upSelfName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserName()}" type="text" name="userName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisName(${person.getUserIdentify()})" value="提交">
</form></c:if></td>
<td class="lf">
<c:if test="${person.getUserIdentify()==0}"><form action="tea.action?action=upSelfSex&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserSex()}" type="text" name="userSex" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisSex()" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==1}"><form action="common.action?action=upSelfSex&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserSex()}" type="text" name="userSex" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisSex()" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==2}"><form action="man.action?action=upSelfSex&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserSex()}" type="text" name="userSex" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisSex()" value="提交">
</form></c:if>
</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==0}"> <form action="tea.action?action=upSelfBirthday&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserBirthday()}" type="text" name="userBirthday" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisBirthday(${person.getUserIdentify()})" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==1}"> <form action="common.action?action=upSelfBirthday&userAccount=${person.getUserAccount()}">
<input placeholder="${person.getUserBirthday()}" type="text" name="userBirthday" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisBirthday(${person.getUserIdentify()})" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==2}"> <form action="man.action?action=upSelfBirthday&userAccount=${person.getUserAccount()}">
<input placeholder="${person.getUserBirthday()}" type="text" name="userBirthday" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisBirthday(${person.getUserIdentify()})" value="提交">
</form></c:if>
</td>
<td class="lf">${person.getUserIdCard()}</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==1}">学生</c:if>
<c:if test="${person.getUserIdentify()==0}">老师</c:if>
</td>
<td class="lf">
<c:if test="${person.getUserIdentify()==0}"> <form action="tea.action?action=upSelfOtherName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserOtherName()}" type="text" name="OtherName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisOtherName(${person.getUserIdentify()})" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==1}"> <form action="common.action?action=upSelfOtherName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserOtherName()}" type="text" name="OtherName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisOtherName(${person.getUserIdentify()})" value="提交">
</form></c:if>
<c:if test="${person.getUserIdentify()==2}"> <form action="man.action?action=upSelfOtherName&userAccount=${person.getUserAccount()}" method="post">
<input placeholder="${person.getUserOtherName()}" type="text" name="OtherName" class="lf">
<input type="submit" style="width: 80px ;margin-left :40px;margin-left: 5px" onclick="return upThisOtherName(${person.getUserIdentify()})" value="提交">
</form></c:if>
</td>
<td ><img style="width: 73px;height: 44px" src="tijiao.png" onclick="upThis(${person.getUserIdentify()})"> </td>
</tr>
</c:forEach>
<span style="color:red; font-size: 5px" id="tip" ></span>
</tr>
</tbody>
</table>
<script>
function upThis(Identify){
if (Identify == 0){
window.location.href="tea.action?action=myThing";
}
if (Identify == 1){
window.location.href="common.action?action=myThing";
}
if (Identify ==2){
window.location.href="man.action?action=myThing";
}
}
function upThisName(){
let userName = document.getElementById("userName").value;
if (userName == null || userName.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfName";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfName";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfName";
// }
}
function upThisSex(){
let userSex = document.getElementById("userSex").value;
if (userSex == null || userSex.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfSex";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfSex";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfSex";
// }
}
function upThisBirthday(){
let userBirthday = document.getElementById("userBirthday").value;
if (userBirthday == null || userBirthday.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfBirthday";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfBirthday";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfBirthday";
// }
}
function upThisOtherName(){
let userOtherName = document.getElementById("userOtherName").value;
if (userOtherName == null || userOtherName.trim()==""){
alert("请正确输入后提交");
return false;
}
// if (Identify == 0){
// window.location.href="tea.action?action=upSelfOtherName";
// }
// if (Identify == 1){
// window.location.href="common.action?action=upSelfOtherName";
// }
// if (Identify ==2){
// window.location.href="man.action?action=upSelfOtherName";
// }
}
</script>
</body>
</html>
<%--
Created by IntelliJ IDEA.
User: 峰。
Date: 2023/8/18
Time: 13:47
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>登录界面</title>
<style>
#outerLoginFrame{
width: 500px;
height: 500px;
margin-left: 500px;
margin-top: 200px;
border: white 0px solid;
}
#innerLoginFrame{
width: 360px;
/*border: grey 2px solid;*/
margin-left: 80px;
margin-top: 50px;
height: 250px;
color: grey;
font-size: 25px;
}
input{
width: 220px;
height: 30px;
}
</style>
</head>
<body>
<div id="outerLoginFrame" style="border:grey 2px solid">
<%-- <span style="position: center"></span>--%>
<h1 style="margin-top: 40px;margin-left: 120px;color: grey">教 务 管 理 系 统</h1>
<div id="innerLoginFrame">
<form action="UserLogin" method="post" >
账户:<input type="text" id="userAccount" name="userAccount" class="myText"><br><br>
密码:<input type="password" id="userPassword" name="userPassword" class="myText"><br><br>
<input type="submit" style="width: 140px ;margin-left :40px" onclick="return checkLogin()" value="登录">
<a href="register.jsp" type="submit" style="width: 140px ;margin-left :20px" value="注册">|  注册</a><br>
<span style="color:red; font-size: 5px" id="tip" ></span>
</form>
</div>
</div>
</body>
</html>
<script>
<%-- 方法--%>
function checkLogin(){
// alert("进来") 弹窗
let userAccount = document.getElementById("userAccount").value;
let userPassword = document.getElementById("userPassword").value;
if (userAccount == null || userAccount.trim()==""){
// alert("账户不能为空");
document.getElementById("tip").innerHTML = "账户不能为空";
return false;
}
else if (userPassword == null || userPassword.trim()==""){
// alert("密码不能为空");
document.getElementById("tip").innerHTML = "密码不能为空";
return false;
}
}
</script>
到了这里,关于一个简单的javaweb小项目(适合新手上手)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!