学生信息管理系统(登录功能)

2023-11-09

工具eclipse

主要操作登陆,增删查改

编写实体类

public class Student {
    private int id;
    private String sId;//学号
    private String name;
    private String password;
    private int classId;//班级号
    private String sex;
    private String mobile;
    private String qq;
    private InputStream photo;//头像
    //get set
}

Dao

介于业务逻辑层和数据库之间,进行数据的访问和操作。

util包

DbUtil(下面dao需要用到)

private String dbUrl= "jdbc:mysql://localhost:3306/student_manager?useUnicode=true&characterEncoding=utf8";
    private String jdbcName="com.mysql.jdbc.Driver";
    private String dbUser="用户名";
    private String dbPassword="密码";
    private Connection connection = null;
    public Connection getConnection() {
        try {
            Class.forName(jdbcName);
            connection=DriverManager.getConnection(dbUrl, dbUser, dbPassword);
            System.out.println("数据库连接成功!!");
        } catch(Exception e) {
            System.out.println("数据库连接失败!!!");
            e.printStackTrace();//在命令行打印异常信息在程序中出错的位置及原因。
        }
        return connection;
    }
    public void closeCon() {
        if(connection !=null) {
            try {
                connection.close();
                System.out.println("数据库连接已经关闭!!!");
            }catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        
    }
    
    public static void main(String[] args) {
        DbUtil dbUtil = new DbUtil();
        dbUtil.getConnection();
    }

CpachaUtil(下面验证码需要用到)

package com.util;
​
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Random;
​
/**
 * 验证码生成器
 */
public class CpachaUtil {
    
    /**
     * 验证码来源
     */
    final private char[] code = {
        '2', '3', '4', '5', '6', '7', '8', '9',
        'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
        'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 
        'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F',
        'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
        'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
    };
    /**
     * 字体
     */
    final private String[] fontNames = new String[]{
            "黑体", "宋体", "Courier", "Arial", 
            "Verdana", "Times", "Tahoma", "Georgia"};
    /**
     * 字体样式
     */
    final private int[] fontStyles = new int[]{
            Font.BOLD, Font.ITALIC|Font.BOLD
    };
    
    /**
     * 验证码长度
     * 默认4个字符
     */
    private int vcodeLen = 4;
    /**
     * 验证码图片字体大小
     * 默认17
     */
    private int fontsize = 21;
    /**
     * 验证码图片宽度
     */
    private int width = (fontsize+1)*vcodeLen+10;
    /**
     * 验证码图片高度
     */
    private int height = fontsize+12;
    /**
     * 干扰线条数
     * 默认3条
     */
    private int disturbline = 3;
    
    
    public CpachaUtil(){}
    
    /**
     * 指定验证码长度
     * @param vcodeLen 验证码长度
     */
    public CpachaUtil(int vcodeLen) {
        this.vcodeLen = vcodeLen;
        this.width = (fontsize+1)*vcodeLen+10;
    }
    
    /**
     * 生成验证码图片
     * @param vcode 要画的验证码
     * @param drawline 是否画干扰线
     * @return
     */
    public BufferedImage generatorVCodeImage(String vcode, boolean drawline){
        //创建验证码图片
        BufferedImage vcodeImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics g = vcodeImage.getGraphics();
        //填充背景色
        g.setColor(new Color(246, 240, 250));
        g.fillRect(0, 0, width, height);
        if(drawline){
            drawDisturbLine(g);
        }
        //用于生成伪随机数
        Random ran = new Random();
        //在图片上画验证码
        for(int i = 0;i < vcode.length();i++){
            //设置字体
            g.setFont(new Font(fontNames[ran.nextInt(fontNames.length)], fontStyles[ran.nextInt(fontStyles.length)], fontsize));
            //随机生成颜色
            g.setColor(getRandomColor());
            //画验证码
            g.drawString(vcode.charAt(i)+"", i*fontsize+10, fontsize+5);
        }
        //释放此图形的上下文以及它使用的所有系统资源
        g.dispose();
        
        return vcodeImage;
    }
    /**
     * 获得旋转字体的验证码图片
     * @param vcode
     * @param drawline 是否画干扰线
     * @return
     */
    public BufferedImage generatorRotateVCodeImage(String vcode, boolean drawline){
        //创建验证码图片
        BufferedImage rotateVcodeImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = rotateVcodeImage.createGraphics();
        //填充背景色
        g2d.setColor(new Color(246, 240, 250));
        g2d.fillRect(0, 0, width, height);
        if(drawline){
            drawDisturbLine(g2d);
        }
        //在图片上画验证码
        for(int i = 0;i < vcode.length();i++){
            BufferedImage rotateImage = getRotateImage(vcode.charAt(i));
            g2d.drawImage(rotateImage, null, (int) (this.height * 0.7) * i, 0);
        }
        g2d.dispose();
        return rotateVcodeImage;
    }
    /**
     * 生成验证码
     * @return 验证码
     */
    public String generatorVCode(){
        int len = code.length;
        Random ran = new Random();
        StringBuffer sb = new StringBuffer();
        for(int i = 0;i < vcodeLen;i++){
            int index = ran.nextInt(len);
            sb.append(code[index]);
        }
        return sb.toString();
    }
    /**
     * 为验证码图片画一些干扰线
     * @param g 
     */
    private void drawDisturbLine(Graphics g){
        Random ran = new Random();
        for(int i = 0;i < disturbline;i++){
            int x1 = ran.nextInt(width);
            int y1 = ran.nextInt(height);
            int x2 = ran.nextInt(width);
            int y2 = ran.nextInt(height);
            g.setColor(getRandomColor());
            //画干扰线
            g.drawLine(x1, y1, x2, y2);
        }
    }
    /**
     * 获取一张旋转的图片
     * @param c 要画的字符
     * @return
     */
    private BufferedImage getRotateImage(char c){
        BufferedImage rotateImage = new BufferedImage(height, height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2d = rotateImage.createGraphics();
        //设置透明度为0
        g2d.setColor(new Color(255, 255, 255, 0));
        g2d.fillRect(0, 0, height, height);
        Random ran = new Random();
        g2d.setFont(new Font(fontNames[ran.nextInt(fontNames.length)], fontStyles[ran.nextInt(fontStyles.length)], fontsize));
        g2d.setColor(getRandomColor());
        double theta = getTheta();
        //旋转图片
        g2d.rotate(theta, height/2, height/2);
        g2d.drawString(Character.toString(c), (height-fontsize)/2, fontsize+5);
        g2d.dispose();
        
        return rotateImage;
    }
    /**
     * @return 返回一个随机颜色
     */
    private Color getRandomColor(){
        Random ran = new Random();
        return new Color(ran.nextInt(220), ran.nextInt(220), ran.nextInt(220)); 
    }
    /**
     * @return 角度
     */
    private double getTheta(){
        return ((int) (Math.random()*1000) % 2 == 0 ? -1 : 1)*Math.random();
    }
​
    /**
     * @return 验证码字符个数
     */
    public int getVcodeLen() {
        return vcodeLen;
    }
    /**
     * 设置验证码字符个数
     * @param vcodeLen
     */
    public void setVcodeLen(int vcodeLen) {
        this.width = (fontsize+3)*vcodeLen+10;
        this.vcodeLen = vcodeLen;
    }
    /**
     * @return 字体大小
     */
    public int getFontsize() {
        return fontsize;
    }
    /**
     * 设置字体大小
     * @param fontsize
     */
    public void setFontsize(int fontsize) {
        this.width = (fontsize+3)*vcodeLen+10;
        this.height = fontsize+15;
        this.fontsize = fontsize;
    }
    /**
     * @return 图片宽度
     */
    public int getWidth() {
        return width;
    }
    /**
     * 设置图片宽度
     * @param width
     */
    public void setWidth(int width) {
        this.width = width;
    }
    /**
     * @return 图片高度
     */
    public int getHeight() {
        return height;
    }
    /**
     * 设置图片高度
     * @param height 
     */
    public void setHeight(int height) {
        this.height = height;
    }
    /**
     * @return 干扰线条数
     */
    public int getDisturbline() {
        return disturbline;
    }
    /**
     * 设置干扰线条数
     * @param disturbline
     */
    public void setDisturbline(int disturbline) {
        this.disturbline = disturbline;
    }
    
}

基础dao

package com.dao;
​
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
​
import com.util.DbUtil;
/**
 * 
 * @author love yourself
 *  基础dao封装基本操作
 */
public class BaseDao {
    private DbUtil dbUtil = new DbUtil();
    
    /**
     * 关闭数据库连接,释放资源
     */
    public void closeCon() {
        dbUtil.closeCon();//DbUtil里面已经写好方法了
    }
    /**
     * 基础查询,多条查询
     */
    //java.sql.ResultSet接口表示一个数据库查询的结果集
    public ResultSet query(String sql) {
        
        try {
            //Statement是将完整的需要执行的SQL语句通过执行平台传输过去
            PreparedStatement prepareStatement =dbUtil.getConnection().prepareStatement(sql);
            return prepareStatement.executeQuery();//executeQuery方法被用来执行 SELECT 语句
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();//输出错误信息
        }
        
        return null;
    }
    /**
     * 改变数据库内容操作
     */
    public boolean update(String sql) {
        try {
            return dbUtil.getConnection().prepareStatement(sql).executeUpdate() > 0;
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;
    }
    
    /**
     * 获取数据库连接
     */
    public Connection getConnection(){
        return dbUtil.getConnection();
    }
}

StudentDao

package com.dao;
​
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
​
import com.entity.Student;
import com.entity.Page;
import com.util.StringUtil;
​
​
//这里要继承我们之前写基础类
public class StudentDao extends BaseDao {
    /**
     * 添加一个学生
     */
    public boolean addStudent(Student student) {
        String sql="insert into student values(null,'"+student.getsId()+"','"+student.getName()+"'";
        sql += ",'" + student.getPassword() + "'," + student.getClassId();
        sql += ",'" + student.getSex() + "','" + student.getMobile() + "'";
        sql += ",'" + student.getQq() + "',null)";
        return update(sql);
    }
    
    /**
     * 删除一个学生
     */
    public boolean deleteStudent(String id) {
        String sql="delete form student where id in("+id+")";
        return update(sql);
    }
    /**
     * 更改密码
     */
    public boolean editPassword(Student student,String newPassword) {
        String sql = "update student set password = '"+newPassword+"' where id = " + student.getId();
        return update(sql);
    }
    /**
     * 头像
     */
    public boolean setStudentPhoto(Student student) {
        String sql = "update student set photo = ? where id = ?";
        Connection connection = getConnection();
        try {
            PreparedStatement prepareStatement = connection.prepareStatement(sql);
            prepareStatement.setBinaryStream(1, student.getPhoto());
            prepareStatement.setInt(2, student.getId());
            return prepareStatement.executeUpdate() > 0;
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return update(sql);
    }
    /**
     * 学生对象
     */
    public Student getStudent(int id){
        String sql = "select * from student where id = " + id;
        Student student = null;
        ResultSet resultSet = query(sql);
        try {
            if(resultSet.next()){
                student = new Student();
                student.setId(resultSet.getInt("id"));
                student.setClassId(resultSet.getInt("class_id"));
                student.setMobile(resultSet.getString("mobile"));
                student.setName(resultSet.getString("name"));
                student.setPassword(resultSet.getString("password"));
                student.setPhoto(resultSet.getBinaryStream("photo"));
                student.setQq(resultSet.getString("qq"));
                student.setSex(resultSet.getString("sex"));
                student.setsId(resultSet.getString("sid"));
                return student;
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return student;
    }
    /**
     * 学生列表
     */
    public List<Student> getStudentList(Student student,Page page){
        List<Student> ret = new ArrayList<Student>();
        String sql = "select * from student ";
        if(!StringUtil.isEmpty(student.getName())){
            sql += "and name like '%" + student.getName() + "%'";
        }
        if(student.getClassId() != 0){
            sql += " and class_id = " + student.getClassId();
        }
        if(student.getId() != 0){
            sql += " and id = " + student.getId();
        }
        sql += " limit " + page.getStart() + "," + page.getPageSize();
        ResultSet resultSet = query(sql.replaceFirst("and", "where"));
        try {
            while(resultSet.next()){
                Student s = new Student();
                s.setId(resultSet.getInt("id"));
                s.setClassId(resultSet.getInt("class_id"));
                s.setMobile(resultSet.getString("mobile"));
                s.setName(resultSet.getString("name"));
                s.setPassword(resultSet.getString("password"));
                s.setPhoto(resultSet.getBinaryStream("photo"));
                s.setQq(resultSet.getString("qq"));
                s.setSex(resultSet.getString("sex"));
                s.setsId(resultSet.getString("sid"));
                ret.add(s);
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return ret;
    }
    /**
     * 学生数量
     */
    public int getStudentListTotal(Student student){
        int total = 0;
        String sql = "select count(*)as total from student ";
        if(!StringUtil.isEmpty(student.getName())){
            sql += "and name like '%" + student.getName() + "%'";
        }
        if(student.getClassId() != 0){
            sql += " and class_id = " + student.getClassId();
        }
        if(student.getId() != 0){
            sql += " and id = " + student.getId();
        }
        ResultSet resultSet = query(sql.replaceFirst("and", "where"));
        try {
            while(resultSet.next()){
                total = resultSet.getInt("total");
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return total;
    }
    /**
     * 登录
     */
    public Student login(String name ,String password){
        String sql = "select * from student where name = '" + name + "' and password = '" + password + "'";
        ResultSet resultSet = query(sql);
        try {
            if(resultSet.next()){
                Student student = new Student();
                student.setId(resultSet.getInt("id"));
                student.setName(resultSet.getString("name"));
                student.setPassword(resultSet.getString("password"));
                student.setClassId(resultSet.getInt("class_id"));
                student.setMobile(resultSet.getString("mobile"));
                student.setPhoto(resultSet.getBinaryStream("photo"));
                student.setQq(resultSet.getString("qq"));
                student.setSex(resultSet.getString("sex"));
                student.setsId(resultSet.getString("sid"));
                return student;
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}

servlet

LoginServlet

package com.servlet;
​
import java.io.IOException;
​
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
​
import com.dao.StudentDao;
import com.entity.Student;
import com.util.StringUtil;
​
/**
 * 登录
 * @author love yourself
 *
 */
public class LoginServlet extends HttpServlet {
    private static final long serialVersionUID = -5870852067427524781L;
    
    /**
     * Get
     */
    public void doGet(HttpServletRequest request,HttpServletResponse response)throws IOException{
        doPost(request, response);
    }
    /**
     * Post
     */
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
        String mehod=request.getParameter("method");//选择的角色
        if("logout".equals(mehod)) {
            logout(request,response);
            return;
        }
        
        String vcode=request.getParameter("vcode");//验证码
        String name=request.getParameter("account");//账户
        String password=request.getParameter("password");
        int type=Integer.parseInt(request.getParameter("type"));//账户类型 整型数据Integer转换为基本数据类型int
        String loginCache=request.getSession().getAttribute("loginCache").toString();//Session缓存
        //判断验证码为空
        if(StringUtil.isEmpty(vcode)) {
            response.getWriter().write("vcodeError");
            return;
        }
        //判断验证码大写的是否相等
        if(!vcode.toUpperCase().equals(loginCache.toUpperCase())){
            response.getWriter().write("vcodeError");
            return;
        }
        //验证码通过,判断用户名密码
        String loginStatus="loginFaild";//登陆状态(用户类型)
        switch(type) {
        //这里还有 1 2是管理员和老师后面再写
        case 2:{
            StudentDao studentDao=new StudentDao();
            Student student=studentDao.login(name, password);
            studentDao.closeCon();//关闭数据库连接释放资源
            if(student == null) {
                response.getWriter().write("loginError");
                return;
            }
            HttpSession session=request.getSession();
            session.setAttribute("user",student);
            session.setAttribute("userType", type);
            loginStatus="loginSuccess";
            break;
        }
        default:
            break;
        }
        response.getWriter().write(loginStatus);    
        }
    
    /**
     * 退出
     */
    private void logout(HttpServletRequest request,HttpServletResponse response) throws IOException{
        request.getSession().removeAttribute("user");
        request.getSession().removeAttribute("userType");
        response.sendRedirect("index.jsp");//返回到主界面也就是登陆界面
        }
}

验证码servlet

package com.servlet;
​
import java.awt.image.BufferedImage;
import java.io.IOException;
​
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
​
import com.util.CpachaUtil;
/**
 * 
 *验证码servlet
 */
public class CpachaServlet extends HttpServlet {
​
    /**
     * 
     */
    private static final long serialVersionUID = 4919529414762301338L;
    public void doGet(HttpServletRequest request,HttpServletResponse reponse) throws IOException{
        doPost(request, reponse);
    }
    public void doPost(HttpServletRequest request,HttpServletResponse reponse) throws IOException{
        String method = request.getParameter("method");
        if("loginCapcha".equals(method)){
            generateLoginCpacha(request, reponse);
            return;
        }
        reponse.getWriter().write("error method");
    }
    private void generateLoginCpacha(HttpServletRequest request,HttpServletResponse reponse) throws IOException{
        CpachaUtil cpachaUtil = new CpachaUtil();
        String generatorVCode = cpachaUtil.generatorVCode();
        request.getSession().setAttribute("loginCapcha", generatorVCode);
        BufferedImage generatorRotateVCodeImage = cpachaUtil.generatorRotateVCodeImage(generatorVCode, true);
        ImageIO.write(generatorRotateVCodeImage, "gif", reponse.getOutputStream());
    }
}

SystemServlet

package com.servlet;
​
import java.io.IOException;
​
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
​
​
import com.dao.StudentDao;
import com.entity.Student;
 
//记着要写继承类 不然报错 java.lang.ClassCastException: com.servlet.SystemServlet cannot be cast to javax.servlet.Servlet
public class SystemServlet extends HttpServlet {
private static final long serialVersionUID = -7258264317769166483L;
    
    public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException{
        doPost(request, response);
    }
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException{
        String method = request.getParameter("method");
        if("toPersonalView".equals(method)){
            personalView(request,response);
            return;
        }else if("EditPasswod".equals(method)){
            editPassword(request,response);
            return;
        }
        try {
            request.getRequestDispatcher("view/system.jsp").forward(request, response);
        } catch (ServletException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

界面

登录 login.jsp

<script type="text/javascript">
    $(function(){
        //点击图片切换验证码
        $("#vcodeImg").click(function(){
            this.src="CpachaServlet?method=loginCapcha&t="+new Date().getTime();
        });
        
        //登录
        $("#submitBtn").click(function(){
            var data = $("#form").serialize();
            $.ajax({
                type: "post",
                url: "LoginServlet?method=Login",
                data: data, 
                dataType: "text", //返回数据类型
                success: function(msg){
                    if("vcodeError" == msg){
                        $.messager.alert("消息提醒", "验证码错误!", "warning");
                        $("#vcodeImg").click();//切换验证码
                        $("input[name='vcode']").val("");//清空验证码输入框
                    } else if("loginError" == msg){
                        $.messager.alert("消息提醒", "用户名或密码错误!", "warning");
                        $("#vcodeImg").click();//切换验证码
                        e
                    } else if("loginSuccess" == msg){
                        window.location.href = "SystemServlet?method=toAdminView";
                    } else{
                        alert(msg);
                    } 
                }
                
            });
        });
        
        //设置复选框
        $(".skin-minimal input").iCheck({
            radioClass: 'iradio-blue',
            increaseArea: '25%'
        });
    })
</script>
<title>登录|学生信息管理系统</title>
<meta name="keywords" content="学生信息管理系统">
</head>
<body>
<div class="header" style="padding: 0;">
    <h2 style="color: white; width: 400px; height: 60px; line-height: 60px; margin: 0 auto; padding: 0;">学生信息管理系统</h2>
</div>
<div class="loginWraper">
  <div id="loginform" class="loginBox">
    <form id="form" class="form form-horizontal" method="post">
      <div class="row cl">
        <label class="form-label col-3"><i class="Hui-iconfont">&#xe60d;</i></label>
        <div class="formControls col-8">
          <input id="" name="account" type="text" placeholder="账户" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <label class="form-label col-3"><i class="Hui-iconfont">&#xe60e;</i></label>
        <div class="formControls col-8">
          <input id="" name="password" type="password" placeholder="密码" class="input-text size-L">
        </div>
      </div>
      <div class="row cl">
        <div class="formControls col-8 col-offset-3">
          <input class="input-text size-L" name="vcode" type="text" placeholder="请输入验证码" style="width: 200px;">
          <img title="点击图片切换验证码" id="vcodeImg" src="CpachaServlet?method=loginCapcha"></div>
      </div>
      
      <div class="mt-20 skin-minimal" style="text-align: center;">
        <div class="radio-box">
            <input type="radio" id="radio-2" name="type" checked value="2" />
            <label for="radio-1">学生</label>
        </div>
        <div class="radio-box">
            <input type="radio" id="radio-3" name="type" value="3" />
            <label for="radio-2">老师</label>
        </div>
        <div class="radio-box">
            <input type="radio" id="radio-1" name="type" value="1" />
            <label for="radio-3">管理员</label>
        </div>
    </div>
      
      <div class="row">
        <div class="formControls col-8 col-offset-3">
          <input id="submitBtn" type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
        </div>
      </div>
    </form>
  </div>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

学生信息管理系统(登录功能) 的相关文章

  • 如何将参数传递到 eclipse-plugin 中的代码模板

    我想创建一个定义新代码模板的插件 喜欢这篇博文 http thomaswabner wordpress com 2009 08 21 use your own variable in eclipse code templates 如何将参数
  • 尝试启动 Eclipse 时 JVM 以退出代码 14 终止

    我刚刚连接到一台我从未使用过的机器 并尝试在那里运行 Eclipse 不幸的是 我收到了错误 Eclipse JVM 终止 退出代码 14 我的配置详细信息在这里 我猜我的配置或该机器的设置有问题 但是Exit code 14没有给我很多继
  • Java:特定枚举和通用 Enum 参数

    我想将任何枚举值传递给实用程序类中的方法并获取相同枚举类型的另一个枚举值 像这样的事情 public class XMLUtils public static Enum defaultValue if element hasAttribut
  • 日食上的垂直白线[重复]

    这个问题在这里已经有答案了 可能的重复 是否可以将 Eclipse 的代码折叠槽设为黑色 https stackoverflow com questions 1041760 is it possible to make eclipses c
  • 从 Eclipse 中的工作应用程序导出后出现 ClassNotFoundException

    因此 在将项目导出到可运行的 jar 后 我收到此消息 我很不明白为什么会这样 因为应用程序正在运行完美当我在 Eclipse 中选择 运行 时 我已经尝试过提取和打包可靠的库 但没有雪茄 有人知道该怎么办吗 Exception in th
  • Eclipse Android 插件中出现“调试证书已过期”错误

    我正在使用 Eclipse Android 插件来构建一个项目 但是我 在控制台窗口中出现此错误 2010 02 03 10 31 14 androidVNC Error generating final archive Debug cer
  • 有没有一种简单的方法可以在 Eclipse 的 java 项目中使用 XML 资源?

    我想用 java 解析 XML 文件 好吧 很简单 如果我可以使用在同一个 Eclipse 项目的文件夹 我们称之为 资源 文件夹 中创建的 XML 文件 那就太好了 由于版本控制 多个开发平台和总体简单性等问题 拥有此功能而不是访问文件系
  • 使用 avr-gcc 编译器/链接器对链接 avrfix 库中函数的未定义引用

    我正在尝试使用avrfix 库 http avrfix sourceforge net 在一个项目中 使用Eclipse v4 2 2 作为IDE avr gcc作为编译器 头文件 avrfix h 和库文件 libavrfix a 都包含
  • Android SDK 安装问题 - 对等点未经过身份验证

    我正在尝试安装 Android SDK 但在 SDK 管理器日志中收到以下错误 Fetching https dl ssl google com android repository addons list 1 xml Failed to
  • 如何在 Eclipse 3.4.1 中导航到书签?

    我可以在源文件中设置书签 但是是否有快捷键可以导航到书签 这navigate菜单有一个转到行 但这没有用 如果勾选 下一个注释 上一个注释 工具栏下拉项中的 书签 项 则可以使用Ctrl and Ctrl 导航到当前打开的文件中的上一个 下
  • Eclipse 中的“环绕”模板:foreach

    我是 Eclipse 新手 主要用于 Java 我之前使用过 IntelliJ Idea 其中可以选择一个扩展 Iteratable 集合 列表等 的变量 并让它生成正确的 foreach 循环 我知道 Eclipse 对 foreach
  • 有没有办法使用 Eclipse 调试 Web 应用程序?

    我正在使用 Eclipse Java IDE 开发 Web 应用程序 我使用 Tomcat 6 作为我的 servlet 容器 可用于 Java 的工具 包括 Eclipse 似乎缺乏 Web 应用程序的调试功能 与 NET 平台的 Vis
  • 为什么在 Eclipse 中对 Egit 管理的项目禁用合并工具?

    根据Egit 用户指南 http wiki eclipse org EGit User Guide Using Merge Tool 要使用合并工具 应右键单击存在合并冲突的资源 然后选择Team gt 合并工具 但是 当我执行此操作时 合
  • 在 java 8 下使用泛型出现类型错误,但在 java 7 下则不然

    我有一段代码可以在 java 7 下编译良好 但不能在 java 8 下编译 这是一个独立的重现示例 我已经采用了显示此问题的真实代码并删除了所有实现 import java util Iterator class ASTNode
  • Eclipse 替换所有类中的文本?

    是否有一个命令可以将 Eclipse 项目中所有 java 文件中的一串代码替换为另一串代码 在 Visual Studio 中 有一个 在所有文件中替换 选项 我在 Eclipse 中似乎找不到该选项 Press Ctrl H or lo
  • 如何减少Eclipse的内存使用?

    Eclipse 3 4 的内存使用量达到了顶峰 以至于成为一个问题 我加载了一个简单的 BlackBerry 项目 使用量飙升至近 400 MB 有时甚至更高 有什么办法可以降低它吗 Eclipse 3 4 会比以前的版本消耗更多的内存 拼
  • Hadoop 作业:任务在 601 秒内无法报告状态

    在伪节点上运行 hadoop 作业时 任务失败并被杀死 错误 任务尝试 在 601 秒内无法报告状态 但同一个程序正在通过 Eclipse 运行 本地作业 任务 大约有 25K 个关键字 输出将是所有可能的组合 一次两个 即大约 25K 2
  • 如何最好地处理不应该提交的 SVN 和本地更改?

    我已经从 SVN 存储库中查看了一些项目 为了构建这些项目 我必须调整一些配置 例如类路径和属性文件 以适应本地环境 现在我不想将这些更改提交到存储库 因此设置 svn ignore 可能会有所帮助 但是 如果我想从存储库获取更新而不提交这
  • Eclipse Java 远程调试器通过 VPN 速度极慢

    我有时被迫离开办公室工作 这意味着我需要通过 VPN 进入我的实验室 我注意到在这种情况下使用 Eclipse 进行远程调试速度非常慢 速度慢到调试器需要 5 7 分钟才能连接到远程 jvm 连接后 每次单步执行断点 行可能需要 20 30
  • 在activity_main.xml中注释

    我是安卓新手 据我所知 XML 中的注释与 HTML 中的注释相同 使用 形式 我想在 Android 项目的 Activity main xml 配置文件中写一些注释 但它给了我错误 值得注意的是 我使用的是 Eclipse 但目前 我直

随机推荐

  • DITA Topic常用开发

    DITA Topic常用开发 Concept Topic用于描述类 Task Topic用于过程类 步骤类 Reference Topic用于过 DITA Topic开发特殊 应急维护手册使用 xtask 案例集手册使用 trbcase 巡
  • 破解2018的Pycharm的与下载JetbrainsCrack-3.1-release-enc.jar的架包

    https pan baidu com s 1L2uJeQIwg jDvHa7t tB6Q 提取码 143o 安装 找到安装目录如下 这里面根据下的版本号来引入 我用的是3 1的 博客转发的是2 8的 要改成3 1 C Program Fi
  • 蓝桥杯2019年第十届真题-人物相关性分析

    题目 题目链接 题解 字符串 滑动区间 不想写题解了 bug没de出来 吃饭去了 代码 我的代码 不知道为什么一直就是91 有大佬帮忙看一下吗 include
  • mybatis 传递参数的7种方法

    文章目录 1 第一种方式 匿名参数 顺序传递参数 2 第二种方式 使用 Param注解 3 使用Map传递参数 4 用过java bean传递多个参数 5 直接使用JSON传递参数 6 传递集合类型参数List Set Array 7 参数
  • 以人为本

    软件团队想要保证高质量的软件交付 一般情况下会想到以下几点 多的测试人员 高薪资 福利 各种质量管理工具和手法 etc 我们有大量的实际经验表明 这些方法往往没有达到预期值 更有甚者 会不那么有效 为何会如此 通过不断的事后回顾 我想导致这
  • Kubernetes核心概念—工作负载

    Kubernetes的工作负载包括五种类型 Deployments 一个 Deployment 控制器为 Pods 和 ReplicaSets 提供声明式的更新能 StatefulSets StatefulSet 是用来管理有状态应用的工作
  • 行为型模式-解释器模式

    package per mjn pattern interpreter import java util HashMap import java util Map 环境角色类 public class Context 定义一个map集合 用
  • C++ 多态

    多态按字面的意思就是多种形态 当类之间存在层次结构 并且类之间是通过继承关联时 就会用到多态 C 多态意味着调用成员函数时 会根据调用函数的对象的类型来执行不同的函数 下面的实例中 基类 Shape 被派生为两个类 如下所示 实例 incl
  • 入行软件测试7年,才知道原来字节跳动这么容易进

    当前就业环境 裁员 失业消息满天飞 好像有一份工作就不错了 更别说高薪了 其实这只是一方面 而另一方面 各大企业依然求贤若渴 高技术人才依然紧缺 只要你技术过硬 拿个年薪50w不是问题 我的人生格言 比你优秀的人不可怕 可怕的是比你优秀的人
  • C# Winform基本知识、文件结构、控件简介

    1 程序入口 Program类 STAThread com线程模型 单线程单位 如果没有它 无法工作 Application 提供了一系列静态化方法和属性 来管理应用程序 Application EnableVisualStyles 启用应
  • Python 异常捕获与处理

    视频版教程 Python3零基础7天入门实战视频教程 异常捕获与处理 如果出现程序异常 我们不去捕获和处理 那么程序遇到异常 就直接终止 后续的代码无法继续执行 这将是可怕的事情 Python提供了完善的异常处理机制 可以实现捕获异常 处理
  • html头部代码

    学习html是件比较容易的事情 但单单学html语言肯定是不够用的 所以大多数人并没有拿html作为学习核心 而是将html作为javascript 动态语言或者css学习的必经之路 于是很多人并不关注一些其他的html标签 主流书籍大多对
  • 【JavaSE系列】第八话 —— 继承和它的边角料们

    导航小助手 思维导图 一 引出继承 二 继承的概念 三 继承的语法 四 父类成员访问 4 1 子类中访问父类的成员变量 4 2 子类访问父类的成员方法 五 super 关键字 5 1 super 成员变量 5 2 super 成员方法 5
  • QT学习 -- 12信号连接信号

    视频学习链接 https www bilibili com video BV1g4411H78N p 12 信号可以连接事件 普通函数 可以连接槽函数 也可以连接信号 一 信号触发 连接 信号 举例如下 当用鼠标点击按键 按键发出点击 cl
  • 【Leetcode】560. 和为K的子数组

    题目描述 给你一个整数数组 nums 和一个整数 k 请你统计并返回该数组中和为 k 的连续子数组的个数 题解 暴力解法 双循环 i指针从左往右走 j指针从i往左走 一个个遍历一个个加起来 直到加到等于k 就计数一次 执行用时 1445 m
  • okhttp异常: java.io.IOException: closed okio.RealBufferedSource$1.read

    java io IOException closed at okio RealBufferedSource 1 read RealBufferedSource java 405 at sun nio cs StreamDecoder rea
  • Redis——redis配置与优化

    文章目录 一 关系数据库与非关系型数据库 1 关系型数据库 2 非关系型数据库 二 Redis 简介 1 Redis的应用场景 2 Redis的优点 三 Redis 安装部署 1 安装Redis 2 配置参数 四 Redis
  • 任务管理器详解

    进程 看是否有除系统外多余进程 可能是病毒或没有完全关闭的进程 影响机器性能 进程下显示了所有当前正在运行的进程 包括应用程序 后台服务等 性能下可以看到CPU和内存 页面文件的使用情况 卡机 死机 中毒时 CPU使用率会达到100 CPU
  • mysql 用sqlyog连接1045错误解决办法(数据库在linux)

    1045 多半就是要么你端口号3306没开 要么就是你密码错误 安装网路分析 yum install net tools 防火墙开放3306端口 root localhost firewall cmd zone public add por
  • 学生信息管理系统(登录功能)

    工具eclipse 主要操作登陆 增删查改 编写实体类 public class Student private int id private String sId 学号 private String name private String