• 大小: 32.5MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-07
  • 语言: 其他
  • 标签: SSM  java  

资源简介

SSM 学校社团系统 包含数据库和文档 可以直接运行 欢迎下载学习

资源截图

代码片段和文件信息

package com.cns.controller;

import java.io.File;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import com.cns.service.CommentService;
import com.cns.service.NewsService;
import com.cns.service.SocietiesService;

@Controller
public class AdminPageController {

@Resource
private NewsService newsService;
@Resource
private CommentService commentService;
@Resource
private  SocietiesService societiesService;


@RequestMapping(“/admin/main“)
public String initMain(HttpServletRequest request){
//Mapject> mainInfo = new HashMapject>();
//mainInfo.put(“newsCount“ newsService.getNewsCount());
//mainInfo.put(“newMsgCount“ commentService.getNoRead());
//mainInfo.put(“productCount“ productService.getProductCount());
//request.setAttribute(“mainInfo“ mainInfo);
return “main.jsp“;
}

@RequestMapping(“/admin/banner.do“)
public String initBanner(HttpServletRequest request){
return “banner.jsp“;
}

@RequestMapping(“/admin/website.do“)
public String initWebsite(HttpServletRequest request){
return “website.jsp“;
}


/**
 * @param slogo
 * @param req
 * @return
 */
@RequestMapping(“/admin/uploadBanner“)
@ResponseBody
public String uploadBanner(@RequestParam(“imgfile“) CommonsMultipartFile imgfile HttpServletRequest request)  {
System.out.println(imgfile.getOriginalFilename());
String t = request.getParameter(“ftype“);
if(t==null) return “0003“;
if( imgfile.getSize()<2*1024*1024 && imgfile.getOriginalFilename().contains(“.png“)){
@SuppressWarnings(“deprecation“)
String path = request.getRealPath(“uploads“);
System.out.println(path);
try {
File dir= new File(path+“/img“);
if(!dir.exists()) dir.mkdir();
if(“banner1“.equals(t)){
File f= new File(path+“/img/banner1.png“);
imgfile.transferTo(f);
return “0000“;
}else if(“banner2“.equals(t)){
File f= new File(path+“/img/banner2.png“);
imgfile.transferTo(f);
return “0000“;
}else if(“banner3“.equals(t)){
File f= new File(path+“/img/banner3.png“);
imgfile.transferTo(f);
return “0000“;
}else if(“jumu“.equals(t)){
File f= new File(path+“/img/jumu.png“);
imgfile.transferTo(f);
return “0000“;
}else{
return “0003“;
}
} catch (Exception e) {
e.printStackTrace();
return “0002“;
}

}else{
return “0001“;
}
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-02-26 12:09  t12\
     文件        1275  2020-02-26 12:01  t12\.classpath
     目录           0  2020-02-26 12:09  t12\.git\
     文件         296  2020-02-26 11:54  t12\.git\config
     文件          73  2020-02-26 11:54  t12\.git\description
     文件          91  2020-02-26 12:04  t12\.git\FETCH_HEAD
     文件          23  2020-02-26 11:54  t12\.git\HEAD
     目录           0  2020-02-26 12:09  t12\.git\hooks\
     文件         478  2020-02-26 11:54  t12\.git\hooks\applypatch-msg.sample
     文件         896  2020-02-26 11:54  t12\.git\hooks\commit-msg.sample
     文件         189  2020-02-26 11:54  t12\.git\hooks\post-update.sample
     文件         424  2020-02-26 11:54  t12\.git\hooks\pre-applypatch.sample
     文件        1642  2020-02-26 11:54  t12\.git\hooks\pre-commit.sample
     文件        1348  2020-02-26 11:54  t12\.git\hooks\pre-push.sample
     文件        4951  2020-02-26 11:54  t12\.git\hooks\pre-rebase.sample
     文件         544  2020-02-26 11:54  t12\.git\hooks\pre-receive.sample
     文件        1239  2020-02-26 11:54  t12\.git\hooks\prepare-commit-msg.sample
     文件        3610  2020-02-26 11:54  t12\.git\hooks\update.sample
     文件       50416  2020-02-26 12:01  t12\.git\index
     目录           0  2020-02-26 11:54  t12\.git\info\
     文件         240  2020-02-26 11:54  t12\.git\info\exclude
     目录           0  2020-02-26 12:09  t12\.git\logs\
     文件         169  2020-02-26 11:54  t12\.git\logs\HEAD
     目录           0  2020-02-26 12:09  t12\.git\logs\refs\
     目录           0  2020-02-26 11:54  t12\.git\logs\refs\heads\
     文件         169  2020-02-26 11:54  t12\.git\logs\refs\heads\master
     目录           0  2020-02-26 12:09  t12\.git\logs\refs\remotes\
     目录           0  2020-02-26 11:54  t12\.git\logs\refs\remotes\origin\
     文件         169  2020-02-26 11:54  t12\.git\logs\refs\remotes\origin\HEAD
     目录           0  2020-02-26 12:09  t12\.git\objects\
     目录           0  2020-02-26 11:54  t12\.git\objects\info\
............此处省略555个文件信息

评论

共有 条评论