• 小项目(一)(问题篇)


    1.前端展示界面输出格式的问题

    2.

     发现后面要用

    new user user 不好区分

    所以entity层里的user改成User

    3.添加用户时中文乱码问题

     req.setCharacterEncoding("UTF-8");

    4.点删除删不掉

     原因:集合用的是list,list无法凭借一个id属性就删除整个对象

    换成map就可以用id来删除对象

        private static Map<Integer,User> map=new HashMap<>();
       private static Map<Integer,User> map=new HashMap<>() ;
        static {
            map.put(1,new User(1,"张三","13124"));
            map.put(2,new User(2,"李四","13125"));
            map.put(3,new User(3,"王五","13126"));
        }
      map.remove(id);

    5.

      req.setAttribute("map", map);

    变成

        req.setAttribute("map", map.values());

    6.

    删除后出现

     将

      req.getRequestDispatcher("index.jsp").forward(req,resp);

    变成

          resp.sendRedirect("/user");

    原因:

    每当

     刷新一次,就调用了一次doget函数,doget里method=null时将集合map传到前端

  • 相关阅读:
    log4net
    配置文件序列化到文件中
    log日志
    Quartz任务管理
    tuple
    mvc视图中使用JavaScriptSerializer
    windows服务安装
    23种设计模式之普通工厂模式代码实例
    23种设计模式之单例模式代码实例
    putty文件传输
  • 原文地址:https://www.cnblogs.com/hanabi-521/p/14334289.html
Copyright © 2020-2023  润新知