• 大小: 10.57MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-17
  • 语言: Java
  • 标签: java  javabean  

资源简介

实现日志的增删改查,适合java初学者

资源截图

代码片段和文件信息

package controllers;

//import java.io.IOException;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;


import javax.servlet.http.HttpSession;

import models.dailylog;
import models.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import services.dailylogService;
import services.globalService;

/**
 * 工作日志
 * @author 孙会明
 *
 */

@Controller
@RequestMapping(“/gzrz/“)
public class dailylogController {

@Autowired
private dailylogService gzrzService;
@Autowired
private globalService gservice;

@RequestMapping(“List“)
public String List(HttpServletRequest request){
HttpSession session = request.getSession();
if(session.getAttribute(“userName“)==null){
return “redirect:/user/“;
}
if(session.getAttribute(“userName“).toString()==““){
return “redirect:/user/“;
}

String stbrq = request.getParameter(“txtsdate“);
String etbrq = request.getParameter(“txtedate“);
String tbr = request.getParameter(“cbxtbr“);

try {
tbr=URLDecoder.decode(tbr “UTF-8“);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

tbr=new String(tbr.getBytes() Charset.forName(“ISO-8859-1“));

System.out.println(request.getContentType());
System.out.println(tbr);

Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(“yyyy-MM-dd“);
String dateString = formatter.format(currentTime);

if(stbrq==null || stbrq.isEmpty()){
stbrq = dateString.substring(0 8) + “01“;
}
if(etbrq==null || etbrq.isEmpty()){
etbrq = dateString;
}
if(tbr==null || tbr.isEmpty()){
tbr = “全部“;
}

ArrayList rs = gzrzService.list(stbrqetbrqtbr);
ArrayList userlist = gservice.getUserList();

request.setAttribute(“stbrq“ stbrq);
request.setAttribute(“etbrq“ etbrq);
request.setAttribute(“tbr“ tbr);
request.setAttribute(“rs“ rs);
request.setAttribute(“userlist“ userlist);
request.setAttribute(“lx“ 1);
return “dailylog.jsp“;
}

@RequestMapping(“Edit“)
public String Edit(HttpServletRequest request){
System.out.println(“id=“+request.getParameter(“id“));
int id=0;
try{
if(request.getParameter(“id“) != null && !(request.getParameter(“id“)).equals(““)){
id=Integer.parseInt(request.getParameter(“id“));
}
}
catch(Exception e){
e.printStackTrace();
}
request.setAttribute(“id“ id);

System.out.println(request.getParameter(“lx“));
int lx=Integer.parseInt(request.getParameter(“lx“));

dailylog rs=null;
if(i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-08-31 15:05  dailyLog\
     文件        1140  2016-08-31 15:05  dailyLog\.classpath
     文件        1333  2016-08-31 15:12  dailyLog\.project
     目录           0  2016-09-12 16:17  dailyLog\.settings\
     文件         522  2016-08-31 15:06  dailyLog\.settings\.jsdtscope
     文件          92  2016-09-12 16:17  dailyLog\.settings\org.eclipse.core.resources.prefs
     文件         364  2016-08-31 15:05  dailyLog\.settings\org.eclipse.jdt.core.prefs
     文件         483  2016-08-31 15:05  dailyLog\.settings\org.eclipse.wst.common.component
     文件         398  2016-08-31 15:06  dailyLog\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2016-08-31 15:06  dailyLog\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2016-08-31 15:06  dailyLog\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2016-08-31 16:10  dailyLog\src\
     目录           0  2016-09-06 16:21  dailyLog\src\controllers\
     文件        6383  2016-09-21 15:06  dailyLog\src\controllers\dailylogController.java
     文件        1105  2016-09-12 11:54  dailyLog\src\controllers\userController.java
     目录           0  2016-09-06 16:13  dailyLog\src\mappers\
     文件        1077  2016-09-07 10:53  dailyLog\src\mappers\dailylogMapper.java
     文件         318  2016-09-06 16:32  dailyLog\src\mappers\globalMapper.java
     文件         439  2016-09-06 16:56  dailyLog\src\mappers\userMapper.java
     目录           0  2016-09-02 15:25  dailyLog\src\models\
     文件        1667  2016-09-01 11:10  dailyLog\src\models\dailylog.java
     文件         388  2016-09-02 18:04  dailyLog\src\models\user.java
     目录           0  2016-09-06 16:10  dailyLog\src\services\
     文件        5773  2016-09-21 14:32  dailyLog\src\services\dailylogService.java
     文件        3156  2016-09-14 10:20  dailyLog\src\services\globalService.java
     文件        2377  2016-09-05 10:04  dailyLog\src\services\MD5.java
     文件         386  2016-09-06 16:43  dailyLog\src\services\userService.java
     目录           0  2016-09-20 14:25  dailyLog\WebRoot\
     目录           0  2016-09-12 15:58  dailyLog\WebRoot\css\
     目录           0  2016-09-12 15:58  dailyLog\WebRoot\css\Aqua\
     目录           0  2016-09-12 15:58  dailyLog\WebRoot\css\Aqua\css\
............此处省略1488个文件信息

评论

共有 条评论