zoukankan      html  css  js  c++  java
  • “校园知网”5月10日冲刺计划书

    • 我昨天的成就(完成了哪个任务,花了多少时间,还剩余多少时间)

    1. 管理员后端发布新闻Action
    2. 管理员后端发布话题Action
    3. 花费了约6+小时的时间
    4. 还剩3天的时间
    • 遇到什么困难

    1. 同样遇到了Jquery中Ajax的使用的问题ajax() 方法通过 HTTP 请求加载远程数据。
    2. 参考博客:https://www.cnblogs.com/tech-bird/p/3515130.html
    3. session赋值与取值的问题,参考博客:https://www.cnblogs.com/xyxxs/p/4621600.html
    package com.classnet.action.admin;
    
    import java.util.List;
    
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.actions.DispatchAction;
    import org.hibernate.criterion.DetachedCriteria;
    import org.hibernate.criterion.MatchMode;
    import org.hibernate.criterion.Order;
    import org.hibernate.criterion.Restrictions;
    
    import com.classnet.dao.AnswerDao;
    import com.classnet.dao.TopicDao;
    import com.classnet.dao.TopicMenuDao;
    import com.classnet.entity.TopicEntity;
    import com.classnet.entity.TopicMenuEntity;
    import com.classnet.util.WebUtils;
    import com.classnet.util.page.IPagination;
    import com.classnet.util.page.SimplePagination;
    import com.classnet.util.page.WebUtil;
    
    public class TopicAction extends DispatchAction{
    
        private TopicMenuDao topicMenuDao;
        private AnswerDao answerDao;
        private TopicDao topicDao;
        public void setTopicDao(TopicDao topicDao) {
            this.topicDao = topicDao;
        }
        public void setTopicMenuDao(TopicMenuDao topicMenuDao) {
            this.topicMenuDao = topicMenuDao;
        }
        @SuppressWarnings("unchecked")
        public ActionForward list(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
    
            int page = WebUtil.getPage(request);
            int pageSize=10;
            String key = request.getParameter("key");
            int menuId = WebUtil.getInteger(request, "menuId");
            DetachedCriteria dc = DetachedCriteria.forClass(TopicEntity.class);
            if(menuId!=0){
                dc.add(Restrictions.eq("menuEntity.id", menuId));
                request.setAttribute("menuId", menuId);
            }
            if(!WebUtils.isEmpty(key)){
                key = new String(key.getBytes("ISO8859-1"),"UTF-8");
                dc.add(Restrictions.like("title", key, MatchMode.ANYWHERE));
                request.setAttribute("key", key);
            }
            IPagination pp = new SimplePagination(dc,Order.desc("id"),true,page,pageSize);
            pp.save(request);
            List<TopicEntity> topicList = pp.getPage();
            request.setAttribute("topicList", topicList);
            
            DetachedCriteria menudc = DetachedCriteria.forClass(TopicMenuEntity.class);
            List<TopicMenuEntity> menuList = topicMenuDao.findByExample(menudc);
            request.setAttribute("menuList", menuList);
            return mapping.findForward("list");
        }
        public ActionForward del(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
            
            int id = WebUtil.getInteger(request, "id");
            String ids = request.getParameter("ids");
            if(id!=0){
                TopicEntity entity = topicDao.selectById(TopicEntity.class, id);
                if(entity!=null){
                    topicDao.delete_(entity);
                    answerDao.delByTopic(id);
                }
            }
            else if(!WebUtils.isEmpty(ids)){
                String [] array = ids.split(",");
                for(String idstr : array){
                    int mid = WebUtils.StringToInt(idstr);
                    if(mid!=0){
                        TopicEntity entity = topicDao.selectById(TopicEntity.class, mid);
                        if(entity!=null){
                            topicDao.delete_(entity);
                            answerDao.delByTopic(mid);
                        }
                    }
                }
            }
            response.sendRedirect(request.getContextPath()+"/admin/topic/topic.do?m=list");
            return null;
        }
        public void setAnswerDao(AnswerDao answerDao) {
            this.answerDao = answerDao;
        }
    }
    • 今天的任务

    1. 将团队成员开发的前端加后端所有的页面进行整合
  • 相关阅读:
    caption标签,为表格添加标题和摘要
    用css样式,为表格加入边框
    table标签,认识网页上的表格
    给div命名,使逻辑更加清晰
    认识div在排版中的作用
    使用ol,添加图书销售排行榜
    使用ul,添加新闻信息列表
    关于tableView在滚动时存在的偏移量问题
    跳转到微信扫一扫
    文件下载的缓存策略
  • 原文地址:https://www.cnblogs.com/fuheishi/p/11056617.html
Copyright © 2011-2022 走看看