diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..99ca10b --- /dev/null +++ b/.classpath @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore index 9154f4c..65b526a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ hs_err_pid* replay_pid* +.externalToolBuilders/ +.settings/ +target/ diff --git a/.project b/.project new file mode 100644 index 0000000..e673423 --- /dev/null +++ b/.project @@ -0,0 +1,58 @@ + + + first + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + + LaunchConfigHandle + <project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.zeroturnaround.eclipse.rebelXmlBuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.jsdt.core.jsNature + org.zeroturnaround.eclipse.jrebelNature + + diff --git a/.springBeans b/.springBeans new file mode 100644 index 0000000..1fbb037 --- /dev/null +++ b/.springBeans @@ -0,0 +1,15 @@ + + + 1 + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e8f2bef --- /dev/null +++ b/pom.xml @@ -0,0 +1,607 @@ + + + 4.0.0 + com.company + first + first + war + 1.0.0-BUILD-SNAPSHOT + + 1.8 + 3.2.18.RELEASE + 1.7.3 + 1.6.6 + + + + + mvn2 + http://repo1.maven.org/maven2/ + + true + + + true + + + + + egovframe + https://maven.egovframe.go.kr/maven + + true + + + false + + + + + + + codelds + https://code.lds.org/nexus/content/groups/main-repo + + + + + + + + + com.nexacro + nexacro17-xapi + 1.0 + + + + com.nexacro + nexacro-xapi + 1.0 + + + + com.tobesoft + xplatform-xapi + 1.0 + + + + org.springframework + spring-context + ${org.springframework-version} + + + + commons-logging + commons-logging + + + + + + org.springframework + spring-web + ${org.springframework-version} + + + + org.springframework + spring-webmvc + ${org.springframework-version} + + + + org.springframework + spring-aop + ${org.springframework-version} + + + + org.springframework + spring-beans + ${org.springframework-version} + + + + org.springframework + spring-context-support + ${org.springframework-version} + + + + org.springframework + spring-core + ${org.springframework-version} + + + + org.springframework + spring-jdbc + ${org.springframework-version} + + + + org.springframework + spring-tx + ${org.springframework-version} + + + + + aopalliance + aopalliance + 1.0 + + + + + org.mybatis + mybatis + 3.2.2 + + + + org.mybatis + mybatis-spring + 1.2.0 + + + + + org.apache.tomcat + tomcat-dbcp + provided + 7.0.53 + + + + commons-dbcp + commons-dbcp + 1.4 + + + + + mysql + mysql-connector-java + 5.1.31 + + + + + com.oracle.database.jdbc + ojdbc8 + 23.7.0.25.01 + + + + + com.oracle.database.jdbc + ojdbc11 + 23.7.0.25.01 + + + + + com.oracle.database.jdbc + ojdbc6 + 11.2.0.4 + + + + + + org.aspectj + aspectjrt + ${org.aspectj-version} + + + + org.aspectj + aspectjweaver + ${org.aspectj-version} + + + + org.aspectj + aspectjtools + ${org.aspectj-version} + + + + + javax.servlet + servlet-api + provided + 2.5 + + + + javax.servlet.jsp + jsp-api + provided + 2.1 + + + + javax.servlet + jstl + 1.2 + + + + javax.annotation + jsr250-api + 1.0 + + + + + org.slf4j + slf4j-api + ${org.slf4j-version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j-version} + + + org.slf4j + slf4j-log4j12 + ${org.slf4j-version} + + + log4j + log4j + 1.3alpha-8 + + + org.lazyluke + log4jdbc-remix + 0.2.7 + + + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + + + + org.codehaus.jackson + jackson-core-asl + 1.9.13 + + + + com.fasterxml.jackson.core + jackson-core + 2.6.4 + + + + com.fasterxml.jackson.core + jackson-databind + 2.6.4 + + + + + commons-io + commons-io + 2.0.1 + + + + commons-fileupload + commons-fileupload + 1.2.2 + + + + + commons-codec + commons-codec + 1.10 + + + + + egovframework.rte + egovframework.rte.fdl.property + 2.7.0 + + + + egovframework.rte + egovframework.rte.ptl.mvc + 3.5.0 + + + + + log4j + log4j + 1.2.15 + + + javax.mail + mail + + + javax.jms + jms + + + com.sun.jdmk + jmxtools + + + com.sun.jmx + jmxri + + + + + + + javax.inject + javax.inject + 1 + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + + + + junit + junit + 4.7 + test + + + + + + install + ${basedir}/target + first + + + maven-eclipse-plugin + 2.9 + + + org.springframework.ide.eclipse.core.springnature + + + org.springframework.ide.eclipse.core.springbuilder + + true + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + ${java-version} + ${java-version} + UTF-8 + -Xlint:all + true + true + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + org.test.int1.Main + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.5 + + + maven-war-plugin + 3.2.2 + + + + + + + + \ No newline at end of file diff --git a/src/main/java/first/common/common/CommandMap.java b/src/main/java/first/common/common/CommandMap.java new file mode 100644 index 0000000..164b321 --- /dev/null +++ b/src/main/java/first/common/common/CommandMap.java @@ -0,0 +1,54 @@ +package first.common.common; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +public class CommandMap { + Map map = new HashMap(); + + public Object get(String key){ + return map.get(key); + } + + public void put(String key, Object value){ + map.put(key, value); + } + + public Object remove(String key){ + return map.remove(key); + } + + public boolean containsKey(String key){ + return map.containsKey(key); + } + + public boolean containsValue(Object value){ + return map.containsValue(value); + } + + public void clear(){ + map.clear(); + } + + public Set> entrySet(){ + return map.entrySet(); + } + + public Set keySet(){ + return map.keySet(); + } + + public boolean isEmpty(){ + return map.isEmpty(); + } + + public void putAll(Map m){ + map.putAll(m); + } + + public Map getMap(){ + return map; + } +} \ No newline at end of file diff --git a/src/main/java/first/common/controller/CommonController.java b/src/main/java/first/common/controller/CommonController.java new file mode 100644 index 0000000..6110d7c --- /dev/null +++ b/src/main/java/first/common/controller/CommonController.java @@ -0,0 +1,45 @@ +package first.common.controller; + +import java.io.File; +import java.net.URLEncoder; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.io.FileUtils; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import first.common.common.CommandMap; +import first.common.service.CommonService; + + +@Controller +public class CommonController +{ + Logger log = Logger.getLogger(this.getClass()); + + @Resource(name="commonService") + private CommonService commonService; + + + @RequestMapping(value="/common/downloadFile.do") + public void downloadFile(CommandMap commandMap, HttpServletResponse response) throws Exception + { //서버에서 화면으로 응답할때 response + Map map = commonService.selectFileInfo(commandMap.getMap()); + String storedFileName = (String)map.get("STORED_FILE_NAME"); + String originalFileName = (String)map.get("ORIGINAL_FILE_NAME"); + + byte fileByte[] = FileUtils.readFileToByteArray(new File("C:\\dev\\file\\"+storedFileName)); + + response.setContentType("application/octet-stream"); + response.setContentLength(fileByte.length); + response.setHeader("Content-Disposition", "attachment; fileName=\"" + URLEncoder.encode(originalFileName,"UTF-8")+"\";"); + response.getOutputStream().write(fileByte); + + response.getOutputStream().flush(); + response.getOutputStream().close(); + } +} diff --git a/src/main/java/first/common/dao/AbstractDAO.java b/src/main/java/first/common/dao/AbstractDAO.java new file mode 100644 index 0000000..61e0ea9 --- /dev/null +++ b/src/main/java/first/common/dao/AbstractDAO.java @@ -0,0 +1,143 @@ +package first.common.dao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mybatis.spring.SqlSessionTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; + +import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; + +public class AbstractDAO { + protected Log log = LogFactory.getLog(AbstractDAO.class); + + @Autowired + private SqlSessionTemplate sqlSession; /* SqlSessionTemplate 는 context-mapper.xml에 정의됨*/ + + protected void printQueryId(String queryId) { + if(log.isDebugEnabled()){ + log.debug("\t QueryId \t: " + queryId); + } + } + + public Object insert(String queryId, Object params){ + printQueryId(queryId); + return sqlSession.insert(queryId, params); + } + + public Object update(String queryId, Object params){ + printQueryId(queryId); + return sqlSession.update(queryId, params); + } + + public Object delete(String queryId, Object params){ + printQueryId(queryId); + return sqlSession.delete(queryId, params); + } + + public Object selectOne(String queryId){ + printQueryId(queryId); + return sqlSession.selectOne(queryId); + } + + public Object selectOne(String queryId, Object params){ + printQueryId(queryId); + return sqlSession.selectOne(queryId, params); + } + + @SuppressWarnings("rawtypes") + public List selectList(String queryId){ + printQueryId(queryId); + return sqlSession.selectList(queryId); + } + + @SuppressWarnings("rawtypes") + public List selectList(String queryId, Object params){ + printQueryId(queryId); + return sqlSession.selectList(queryId,params); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + public Map selectPagingList(String queryId, Object params) + { + printQueryId(queryId); + + Map map = (Map) params; + PaginationInfo paginationInfo = null; + + //containsKey 일치여부 + if(map.containsKey("currentPageNo") == false || StringUtils.isEmpty(map.get("currentPageNo")) == true) + map.put("currentPageNo", "1"); + + paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(Integer.parseInt(map.get("currentPageNo").toString())); + if(map.containsKey("PAGE_ROW") == false || StringUtils.isEmpty(map.get("PAGE_ROW")) == true) + { + paginationInfo.setRecordCountPerPage(15); //몇개의 행을 보여줄지 셋 + }else{ + paginationInfo.setRecordCountPerPage(Integer.parseInt(map.get("PAGE_ROW").toString())); + } + paginationInfo.setPageSize(10); //페이지 크기 지정 1~10 + + int start = paginationInfo.getFirstRecordIndex(); + int end = start + paginationInfo.getRecordCountPerPage(); + map.put("START",start+1); + map.put("END",end); + + params = map; + + Map returnMap = new HashMap(); + List> list = sqlSession.selectList(queryId,params); + + if(list.size() == 0){ + map = new HashMap(); + map.put("TOTAL_COUNT",0); + list.add(map); + + if(paginationInfo != null){ + paginationInfo.setTotalRecordCount(0); + returnMap.put("paginationInfo", paginationInfo); + } + } + else{ + if(paginationInfo != null){ + paginationInfo.setTotalRecordCount(Integer.parseInt(list.get(0).get("TOTAL_COUNT").toString())); + returnMap.put("paginationInfo", paginationInfo); + } + } + returnMap.put("result", list); + return returnMap; + } + + /*@SuppressWarnings("unchecked") + public Object selectPagingList(String queryId, Object params) + { + printQueryId(queryId); + Map map = (Map)params; + + String strPageIndex = (String)map.get("PAGE_INDEX"); //페이지 번호 + String strPageRow = (String)map.get("PAGE_ROW"); //페이지 행수 + int nPageIndex = 0; + int nPageRow = 20; + + if(StringUtils.isEmpty(strPageIndex) == false) + { + nPageIndex = Integer.parseInt(strPageIndex)-1; + } + if(StringUtils.isEmpty(strPageRow) == false) + { + nPageRow = Integer.parseInt(strPageRow); + } + + map.put("START", (nPageIndex * nPageRow) + 1); + map.put("END", (nPageIndex * nPageRow) + nPageRow); + + return sqlSession.selectList(queryId, map); + }*/ +} + + diff --git a/src/main/java/first/common/dao/CommonDAO.java b/src/main/java/first/common/dao/CommonDAO.java new file mode 100644 index 0000000..42cc073 --- /dev/null +++ b/src/main/java/first/common/dao/CommonDAO.java @@ -0,0 +1,17 @@ +package first.common.dao; + +import java.util.Map; + +import org.springframework.stereotype.Repository; + +@Repository("commonDAO") +public class CommonDAO extends AbstractDAO +{ + + @SuppressWarnings("unchecked") + public Map selectFileInfo(Map map) throws Exception + { + return (Map)selectOne("common.selectFileInfo", map); + } + +} diff --git a/src/main/java/first/common/logger/LoggerAspect.java b/src/main/java/first/common/logger/LoggerAspect.java new file mode 100644 index 0000000..1624f9c --- /dev/null +++ b/src/main/java/first/common/logger/LoggerAspect.java @@ -0,0 +1,37 @@ +package first.common.logger; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +public class LoggerAspect +{ + protected Log log = LogFactory.getLog(LoggerAspect.class); + static String name = ""; + static String type = ""; + + @Around("execution(* first..controller.*Controller.*(..)) or execution(* first..service.*Imple.*(..)) or execution(* first..dao.*DAO.*(..))") + public Object logPrint(ProceedingJoinPoint joinPoint) throws Throwable + { + type = joinPoint.getSignature().getDeclaringTypeName(); + + if(type.indexOf("Controller") > -1) + { + name = "Controller \t: "; + } + else if(type.indexOf("Service") > -1) + { + name = "ServiceImpl \t: "; + } + else if(type.indexOf("DAO") > -1) + { + name = "DAO \t\t: "; + } + log.debug(name + type + "." + joinPoint.getSignature().getName() + "()"); + + return joinPoint.proceed(); + } +} diff --git a/src/main/java/first/common/logger/LoggerInterceptor.java b/src/main/java/first/common/logger/LoggerInterceptor.java new file mode 100644 index 0000000..fac9946 --- /dev/null +++ b/src/main/java/first/common/logger/LoggerInterceptor.java @@ -0,0 +1,37 @@ +package first.common.logger; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + + +public class LoggerInterceptor extends HandlerInterceptorAdapter +{ + protected Log log = LogFactory.getLog(LoggerInterceptor.class); + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)throws Exception + { + if(log.isDebugEnabled()) + { + log.debug("================== START ======================"); + System.out.println("dddddd"); + log.debug(" Request URI \t : "+request.getRequestURI()); + } + + return super.preHandle(request, response, handler); + } + + @Override + public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception + { + if(log.isDebugEnabled()) + { + log.debug("=================== END ======================="); + } + } +} diff --git a/src/main/java/first/common/resolver/CustomMapArgumentResolver.java b/src/main/java/first/common/resolver/CustomMapArgumentResolver.java new file mode 100644 index 0000000..7a7b14a --- /dev/null +++ b/src/main/java/first/common/resolver/CustomMapArgumentResolver.java @@ -0,0 +1,45 @@ +package first.common.resolver; + +import java.util.Enumeration; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.core.MethodParameter; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; + +import first.common.common.CommandMap; + +public class CustomMapArgumentResolver implements HandlerMethodArgumentResolver +{ + @Override + public boolean supportsParameter(MethodParameter parameter) + { + return CommandMap.class.isAssignableFrom(parameter.getParameterType()); + } //컨트롤러의 파라미터가 CommandMap클래스인지 검사 + + @Override + public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception + { + CommandMap commandMap = new CommandMap(); //객체생성 + + HttpServletRequest request = (HttpServletRequest)webRequest.getNativeRequest(); + Enumeration enumeration = request.getParameterNames(); + + String key = null; + String[] values = null; + while(enumeration.hasMoreElements()) + { + key = (String)enumeration.nextElement(); + values = request.getParameterValues(key); + + if(values != null) + { + commandMap.put(key, (values.length > 1)?values:values[0]); + } + } + return commandMap; + } +} diff --git a/src/main/java/first/common/service/CommonService.java b/src/main/java/first/common/service/CommonService.java new file mode 100644 index 0000000..2821727 --- /dev/null +++ b/src/main/java/first/common/service/CommonService.java @@ -0,0 +1,8 @@ +package first.common.service; + +import java.util.Map; + +public interface CommonService +{ + Map selectFileInfo(Map map) throws Exception; +} diff --git a/src/main/java/first/common/service/CommonServiceImpl.java b/src/main/java/first/common/service/CommonServiceImpl.java new file mode 100644 index 0000000..6e54dc1 --- /dev/null +++ b/src/main/java/first/common/service/CommonServiceImpl.java @@ -0,0 +1,26 @@ +package first.common.service; + +import java.util.Map; + +import javax.annotation.Resource; + +import org.apache.log4j.Logger; +import org.springframework.stereotype.Service; + +import first.common.dao.CommonDAO; + + +@Service("commonService") +public class CommonServiceImpl implements CommonService +{ + Logger log = Logger.getLogger(this.getClass()); + + @Resource(name="commonDAO") + private CommonDAO commonDAO; + + @Override + public Map selectFileInfo(Map map) throws Exception + { + return commonDAO.selectFileInfo(map); + } +} diff --git a/src/main/java/first/common/util/CommonUtils.java b/src/main/java/first/common/util/CommonUtils.java new file mode 100644 index 0000000..cb587d3 --- /dev/null +++ b/src/main/java/first/common/util/CommonUtils.java @@ -0,0 +1,11 @@ +package first.common.util; + +import java.util.UUID; + +public class CommonUtils +{ + public static String getRandomString() + { + return UUID.randomUUID().toString().replaceAll("-", ""); + } +} diff --git a/src/main/java/first/common/util/FileUtils.java b/src/main/java/first/common/util/FileUtils.java new file mode 100644 index 0000000..8580e28 --- /dev/null +++ b/src/main/java/first/common/util/FileUtils.java @@ -0,0 +1,85 @@ +package first.common.util; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +@Component("fileUtils") +public class FileUtils +{ + private static final String filePath = "c:\\dev\\file\\"; //파일 저장위치 선언 + + public List> parseInsertFileInfo(Map map, HttpServletRequest request) throws Exception + { + MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest)request; + Iterator iterator = multipartHttpServletRequest.getFileNames(); + + MultipartFile multipartFile = null; + String originalFileName = null; + String originalFileExtension = null; + String storedFileName = null; + + List> list = new ArrayList>(); + Map listMap = null; + + String boardIdx = (String)map.get("IDX"); //게시글 번호 받아오는 부분 + String requestName = null; + String idx = null; + + /*File file = new File(filePath); + if(file.exists() == false) + { + file.mkdirs(); + } //경로 없으면 만들어줘라 +*/ + while(iterator.hasNext()) + { + multipartFile = multipartHttpServletRequest.getFile(iterator.next()); + if(multipartFile.isEmpty() == false) + { + originalFileName = multipartFile.getOriginalFilename(); + originalFileExtension = originalFileName.substring(originalFileName.lastIndexOf(".")); //확장자명을 짤라서 저장하고 + storedFileName = CommonUtils.getRandomString() + originalFileExtension; //파일이름 랜덤하고 돌리고 짤랐던거 확장자 붙이고, + + /*file = new File(filePath + storedFileName); + multipartFile.transferTo(file);*/ + + multipartFile.transferTo(new File(filePath + storedFileName)); + + listMap = new HashMap(); + /*listMap.put("BOARD_IDX", boardIdx); + listMap.put("ORIGINAL_FILE_NAME", originalFileName); + listMap.put("STORED_FILE_NAME", storedFileName); + listMap.put("FILE_SIZE", multipartFile.getSize());*/ + + listMap.put("IS_NEW", "Y"); + listMap.put("BOARD_IDX", boardIdx); + listMap.put("ORIGINAL_FILE_NAME", originalFileName); + listMap.put("STORED_FILE_NAME", storedFileName); + listMap.put("FILE_SIZE", multipartFile.getSize()); + list.add(listMap); + }else{ + requestName = multipartFile.getName(); + idx = "IDX_" + requestName.substring(requestName.indexOf("_")+1); + if(map.containsKey(idx)==true&&map.get(idx)!=null) + { + listMap = new HashMap(); + listMap.put("IS_NEW", "N"); + listMap.put("FILE_IDX", map.get(idx)); + list.add(listMap); + } + } + } + + return list; + } +} diff --git a/src/main/java/first/sample/controller/SampleController.java b/src/main/java/first/sample/controller/SampleController.java new file mode 100644 index 0000000..2f7d459 --- /dev/null +++ b/src/main/java/first/sample/controller/SampleController.java @@ -0,0 +1,168 @@ +package first.sample.controller; + +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import com.fasterxml.jackson.annotation.JsonCreator.Mode; + +import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import first.common.common.CommandMap; +import first.sample.service.SampleService; + +@Controller +public class SampleController +{ + Logger log = Logger.getLogger(this.getClass()); //로그 찍고 + + @Resource(name="sampleService") + private SampleService sampleService; //샘플서비스 선언하고 + + + + @RequestMapping(value="/sample/openBoardSearch.do") + public ModelAndView openBoardSearch(CommandMap commandMap) throws Exception + { + ModelAndView mv = new ModelAndView("/sample/boardSearch"); + return mv; + } + + + @RequestMapping(value="/sample/openBoardList.do") //경로 맵핑해주고~ + public ModelAndView openBoardList(CommandMap commandMap) throws Exception + { //모델뷰 만들고 openSampleBoardList 메서드 만들고 + ModelAndView mv = new ModelAndView("/sample/boardList"); //모델뷰 객체 선언뒤 jsp파일 지정 + + Map resultMap = sampleService.selectBoardList(commandMap.getMap()); + //List> list = sampleService.selectBoardList(commandMap); + //앞에서 샘플서비스 선언한것 뒤에 selectBoardList라는 메서드 만들고 + //mv.addObject("list", list); //앞에서 실행 다하고 list에 담긴건 list라고 선언하고 + + mv.addObject("paginationInfo", (PaginationInfo)resultMap.get("paginationInfo")); + mv.addObject("list", resultMap.get("result")); + + System.out.println("========JRebel Test============"); + log.debug("======JRebel Test2======"); + + return mv; + + + } + + @RequestMapping(value="/sample/testMapArgumentResolver.do") + public ModelAndView testMapArgumentResolver(CommandMap commandMap) throws Exception + { + ModelAndView mv = new ModelAndView(""); + + if(commandMap.isEmpty() == false) + { + Iterator> iterator = commandMap.getMap().entrySet().iterator(); + Entry entry = null; + while(iterator.hasNext()) + { + entry = iterator.next(); + log.debug("key :"+entry.getKey()+", value :"+entry.getValue()); + } + } + + return mv; + } + + + @RequestMapping(value="/sample/openBoardWrite.do") + public ModelAndView openBoardWrite(CommandMap commandMap) throws Exception + { + + ModelAndView mv = new ModelAndView("/sample/boardWrite"); //JSP 파일 지정 + System.out.println("========JRebel Test============"); + return mv; + } + + @RequestMapping(value="/sample/Test.do") + public ModelAndView Test(CommandMap commandMap) throws Exception + { + + ModelAndView mv = new ModelAndView("/sample/Test"); //JSP 파일 지정 + System.out.println("========Test Test============"); + return mv; + } + + @RequestMapping(value="/sample/kk.do") + public ModelAndView kk(CommandMap commandMap) throws Exception + { + + ModelAndView mv = new ModelAndView("/sample/kk"); //JSP 파일 지정 + System.out.println("========kk Test============"); + return mv; + } + + + + + @RequestMapping(value="/sample/insertBoard.do") + public ModelAndView insertBoard(CommandMap commandMap, HttpServletRequest request) throws Exception + { + ModelAndView mv = new ModelAndView("redirect:/sample/openBoardList.do"); + + sampleService.insertBoard(commandMap.getMap(), request); + + return mv; + } + + @RequestMapping(value="/sample/openBoardDetail.do") + public ModelAndView openBoardDetail(CommandMap commandMap) throws Exception + { + ModelAndView mv = new ModelAndView("/sample/boardDetail"); + + Map map = sampleService.selectBoardDetail(commandMap.getMap()); + + mv.addObject("map", map.get("map")); + mv.addObject("list", map.get("list")); //요건 첨부파일 목록 부를때 쓸거임 + + return mv; + } + + @RequestMapping(value="/sample/openBoardUpdate.do") //수정디테일화면 + public ModelAndView openBoardUpdate(CommandMap commandMap) throws Exception + { + ModelAndView mv = new ModelAndView("/sample/boardUpdate"); + + Map map = sampleService.boardUpdate(commandMap.getMap()); + + mv.addObject("map", map.get("map")); //내용 + mv.addObject("list", map.get("list")); //첨부파일 + + return mv; + } + + @RequestMapping(value="/sample/updateBoard.do") //수정하기 누르는~~ 혹은 저장하기 누르는~~ + public ModelAndView updateBoard(CommandMap commandMap, HttpServletRequest request) throws Exception + { + ModelAndView mv = new ModelAndView("redirect:/sample/openBoardDetail.do"); + + sampleService.updateBoard(commandMap.getMap(), request); + + mv.addObject("IDX", commandMap.get("IDX")); + return mv; + } + + @RequestMapping(value="/sample/deleteBoard.do") + public ModelAndView deleteBoard(CommandMap commandMap) throws Exception + { + ModelAndView mv = new ModelAndView("redirect:/sample/openBoardList.do"); + + sampleService.deleteBoard(commandMap.getMap()); + + return mv; + } + + +} diff --git a/src/main/java/first/sample/dao/SampleDAO.java b/src/main/java/first/sample/dao/SampleDAO.java new file mode 100644 index 0000000..4afc4ef --- /dev/null +++ b/src/main/java/first/sample/dao/SampleDAO.java @@ -0,0 +1,79 @@ +package first.sample.dao; + +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Repository; + +import first.common.dao.AbstractDAO; + +@Repository("sampleDAO") //@Repository DAO선언시 주로 사용 +public class SampleDAO extends AbstractDAO //오 요건 extends로 상속 받았으니 그대로 쓰면됨 +{ + + @SuppressWarnings("unchecked") //에러 경고문 필요없음 + public Map selectBoardList(Map map) throws Exception + { + //return (List>) selectList("sample.selectBoardList", map); + //첫번째 인자값이 쿼리 이름 -> sample.selectBoardList + return (Map) selectPagingList("sample.selectBoardList", map); + } + + public void insertBoard(Map map) throws Exception + { + insert("sample.insertBoard", map); + } + + public void insertFile(Map map) throws Exception + { + insert("sample.insertFile", map); + } + + /*public void updateHitCnt(Map map) throws Exception + { + update("sample.updateHitCnt", map); + }*/ + + @SuppressWarnings("unchecked") + public Map selectBoardDetail(Map map) throws Exception{ + return (Map) selectOne("sample.selectBoardDetail", map); + } + + @SuppressWarnings("unchecked") + public List> selectFileList(Map map) throws Exception + { + return (List>) selectList("sample.selectFileList", map); + } + + @SuppressWarnings("unchecked") + public Map boardUpdate(Map map) throws Exception + { + return (Map) selectOne("sample.boardUpdate", map); + } + + public void updateBoard(Map map) throws Exception + { + update("sample.updateBoard", map); + } + + public void deleteBoard(Map map) throws Exception + { + delete("sample.deleteBoard", map); + } + + public void updateHitCnt(Map map) + { + update("sample.updateHitCnt", map); + } + + public void deleteFileList(Map map) + { + update("sample.deleteFileList", map); + } + + public void updateFile(Map map) + { + update("sample.updateFile", map); + } + +} diff --git a/src/main/java/first/sample/service/SampleService.java b/src/main/java/first/sample/service/SampleService.java new file mode 100644 index 0000000..93fa0de --- /dev/null +++ b/src/main/java/first/sample/service/SampleService.java @@ -0,0 +1,25 @@ +package first.sample.service; + +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +public interface SampleService { + + Map selectBoardList(Map map) throws Exception; + + void insertBoard(Map map, HttpServletRequest request) throws Exception; + + Map selectBoardDetail(Map map) throws Exception; + + Map boardUpdate(Map map) throws Exception; + + void updateBoard(Map map, HttpServletRequest request) throws Exception; + + void deleteBoard(Map map) throws Exception; + + + + + +} diff --git a/src/main/java/first/sample/service/SampleServiceImpl.java b/src/main/java/first/sample/service/SampleServiceImpl.java new file mode 100644 index 0000000..1acefdb --- /dev/null +++ b/src/main/java/first/sample/service/SampleServiceImpl.java @@ -0,0 +1,121 @@ +package first.sample.service; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import org.apache.log4j.Logger; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; + +import first.common.util.FileUtils; +import first.sample.dao.SampleDAO; + + +@Service("sampleService") +public class SampleServiceImpl implements SampleService //인터페이스 상속시 implements +{ //SampleSeriveImpl 클래스 선언하는데 SampleSerive + Logger log = Logger.getLogger(this.getClass()); //로그 한번 찍어주고 + + @Resource(name="fileUtils") + private FileUtils fileUtils; + + @Resource(name="sampleDAO") + private SampleDAO sampleDAO; //SampleDAO 선언해주고 + + @Override //implements로 상속 받았으니 @Override로 재 정의해줌(SampleService에서 정의한놈) + public Map selectBoardList(Map map) throws Exception { + + return sampleDAO.selectBoardList(map); + } + + @Override + public void insertBoard(Map map, HttpServletRequest request) throws Exception + { + sampleDAO.insertBoard(map); + + List> list = fileUtils.parseInsertFileInfo(map, request); + for(int i=0,size=list.size();i iterator = multipartHttpServletRequest.getFileNames(); + MultipartFile multipartFile = null; + + while(iterator.hasNext()) + { + multipartFile = multipartHttpServletRequest.getFile(iterator.next()); + + if(multipartFile.isEmpty() == false) + { + log.debug("--------------file start------------"); + log.debug("name :" + multipartFile.getName()); + log.debug("filename :" + multipartFile.getOriginalFilename()); + log.debug("size :" + multipartFile.getSize()); + log.debug("--------------file end--------------\n"); + } + } + } + + @Override + public Map selectBoardDetail(Map map) throws Exception + { + sampleDAO.updateHitCnt(map); + + Map resultMap = new HashMap(); + Map tempMap = sampleDAO.selectBoardDetail(map); + resultMap.put("map", tempMap); + + List> list = sampleDAO.selectFileList(map); + resultMap.put("list", list); + + return resultMap; + } + + @Override + public Map boardUpdate(Map map) throws Exception + { + Map resultMap = new HashMap(); + Map tempMap = sampleDAO.boardUpdate(map); + resultMap.put("map", tempMap); + + List> list = sampleDAO.selectFileList(map); + resultMap.put("list", list); + + return resultMap; + } + + @Override + public void updateBoard(Map map, HttpServletRequest request) throws Exception + { + sampleDAO.updateBoard(map); //기존 글만 수정(업데이트) + + sampleDAO.deleteFileList(map); // (DEL_GB = 'Y') 로 처리하는 부분 + List> list = fileUtils.parseInsertFileInfo(map, request); + Map tempMap = null; + for(int i=0,size=list.size();i map) throws Exception { + + sampleDAO.deleteBoard(map); + + } +} diff --git a/src/main/java/test/test.java b/src/main/java/test/test.java new file mode 100644 index 0000000..4e0ac5c --- /dev/null +++ b/src/main/java/test/test.java @@ -0,0 +1,15 @@ +package test; + +public class test { + + public static void main(String[] args) + { + try{ + String str = "abc"; + Integer.parseInt(str); + }catch(Exception e){ + System.out.println("Error"); + } + } + +} diff --git a/src/main/resources/config/spring/context-aspect.xml b/src/main/resources/config/spring/context-aspect.xml new file mode 100644 index 0000000..c1e303f --- /dev/null +++ b/src/main/resources/config/spring/context-aspect.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/config/spring/context-common.xml b/src/main/resources/config/spring/context-common.xml new file mode 100644 index 0000000..9e32d6d --- /dev/null +++ b/src/main/resources/config/spring/context-common.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/config/spring/context-datasource.xml b/src/main/resources/config/spring/context-datasource.xml new file mode 100644 index 0000000..5c1f747 --- /dev/null +++ b/src/main/resources/config/spring/context-datasource.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/config/spring/context-mapper.xml b/src/main/resources/config/spring/context-mapper.xml new file mode 100644 index 0000000..edd7018 --- /dev/null +++ b/src/main/resources/config/spring/context-mapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/log4j.dtd b/src/main/resources/log4j.dtd new file mode 100644 index 0000000..53fe0cd --- /dev/null +++ b/src/main/resources/log4j.dtd @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/log4j.xml b/src/main/resources/log4j.xml new file mode 100644 index 0000000..3efa69d --- /dev/null +++ b/src/main/resources/log4j.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/common/Common_SQL.xml b/src/main/resources/mapper/common/Common_SQL.xml new file mode 100644 index 0000000..8fe0f95 --- /dev/null +++ b/src/main/resources/mapper/common/Common_SQL.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/sample/Sample_SQL.xml b/src/main/resources/mapper/sample/Sample_SQL.xml new file mode 100644 index 0000000..2a7cdef --- /dev/null +++ b/src/main/resources/mapper/sample/Sample_SQL.xml @@ -0,0 +1,188 @@ + + + + + + + + + SELECT SEQ_TB_BOARD_IDX.NEXTVAL FROM DUAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/rebel.xml b/src/main/resources/rebel.xml new file mode 100644 index 0000000..644022d --- /dev/null +++ b/src/main/resources/rebel.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/._.DS_Store b/src/main/webapp/._.DS_Store new file mode 100644 index 0000000..28c42fb Binary files /dev/null and b/src/main/webapp/._.DS_Store differ diff --git a/src/main/webapp/WEB-INF/._.DS_Store b/src/main/webapp/WEB-INF/._.DS_Store new file mode 100644 index 0000000..28c42fb Binary files /dev/null and b/src/main/webapp/WEB-INF/._.DS_Store differ diff --git a/src/main/webapp/WEB-INF/config/action-servlet.xml b/src/main/webapp/WEB-INF/config/action-servlet.xml new file mode 100644 index 0000000..0c2900e --- /dev/null +++ b/src/main/webapp/WEB-INF/config/action-servlet.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/include/._include-body.jspf b/src/main/webapp/WEB-INF/include/._include-body.jspf new file mode 100644 index 0000000..b32f778 Binary files /dev/null and b/src/main/webapp/WEB-INF/include/._include-body.jspf differ diff --git a/src/main/webapp/WEB-INF/include/include-body.jspf b/src/main/webapp/WEB-INF/include/include-body.jspf new file mode 100644 index 0000000..140e6bf --- /dev/null +++ b/src/main/webapp/WEB-INF/include/include-body.jspf @@ -0,0 +1,2 @@ +<%@ page pageEncoding="UTF-8"%> +
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/include/include-header.jspf b/src/main/webapp/WEB-INF/include/include-header.jspf new file mode 100644 index 0000000..515d629 --- /dev/null +++ b/src/main/webapp/WEB-INF/include/include-header.jspf @@ -0,0 +1,15 @@ +<%@ page pageEncoding="UTF-8"%> + + + +bloggers + +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %> + + + + + + diff --git a/src/main/webapp/WEB-INF/jsp/sample/Test.jsp b/src/main/webapp/WEB-INF/jsp/sample/Test.jsp new file mode 100644 index 0000000..aacc1ce --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/Test.jsp @@ -0,0 +1,94 @@ +<%@ page language="java" contentType="text/html; charset=EUC-KR" + pageEncoding="EUC-KR"%> + + + + +Insert title here +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ include file ="/WEB-INF/include/include-header.jspf" %> + + + +

게시판 목록

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
글번호제목
${row.IDX } + ${row.TITLE } + +
조회된 결과가 없습니다.
+ + + + + +
+ 글쓰기 + + <%@ include file="/WEB-INF/include/include-body.jspf" %> + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/Test01.jsp b/src/main/webapp/WEB-INF/jsp/sample/Test01.jsp new file mode 100644 index 0000000..0baca3b --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/Test01.jsp @@ -0,0 +1,24 @@ +<%@ page language="java" contentType="text/html; charset=EUC-KR" + pageEncoding="EUC-KR"%> + + + + + + +Insert title here + + + +

+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/boardDetail.jsp b/src/main/webapp/WEB-INF/jsp/sample/boardDetail.jsp new file mode 100644 index 0000000..6ed9e00 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/boardDetail.jsp @@ -0,0 +1,103 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +Insert title here +<%@ include file="/WEB-INF/include/include-header.jspf" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
게시글 상세
글 번호${map.IDX }조회수${map.HIT_CNT }
작성자${map.CREA_ID }작성시간${map.CREA_DTM }
제목${map.TITLE }
${map.CONTENTS }
첨부파일 + + + + + ${row.ORIGINAL_FILE_NAME } + (${row.FILE_SIZE }kb) + + + 첨부된 파일이 없습니다.! + +
+ + 목록으로 + 수정하기 + + <%@ include file="/WEB-INF/include/include-body.jspf" %> + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/boardList.jsp b/src/main/webapp/WEB-INF/jsp/sample/boardList.jsp new file mode 100644 index 0000000..9c67714 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/boardList.jsp @@ -0,0 +1,100 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +Insert title here +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ include file ="/WEB-INF/include/include-header.jspf" %> + + + +

게시판 목록

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
글번호제목조회수작성일
${row.IDX } + ${row.TITLE } + + ${row.HIT_CNT }${row.CREA_DTM }
조회된 결과가 없습니다.
+ + + + + + +
+ 글쓰기 + + <%@ include file="/WEB-INF/include/include-body.jspf" %> + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/boardSearch.jsp b/src/main/webapp/WEB-INF/jsp/sample/boardSearch.jsp new file mode 100644 index 0000000..d3d22da --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/boardSearch.jsp @@ -0,0 +1,13 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + +Insert title here +<%@ include file="/WEB-INF/include/include-header.jspf" %> + + +HI~ +<%@ include file="/WEB-INF/include/include-body.jspf" %> + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/boardUpdate.jsp b/src/main/webapp/WEB-INF/jsp/sample/boardUpdate.jsp new file mode 100644 index 0000000..76ed53e --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/boardUpdate.jsp @@ -0,0 +1,164 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +Insert title here +<%@ include file="/WEB-INF/include/include-header.jspf" %> + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
게시글 상세
글 번호 + ${map.IDX } + + 조회수${map.HIT_CNT }
작성자${map.CREA_ID }작성시간${map.CREA_DTM }
제목 + +
+ +
첨부파일 +
+ + + +

+ + ${row.ORIGINAL_FILE_NAME } + + (${row.FILE_SIZE }kb) + 삭제 +

+
+
+ 첨부된 파일이 없습니다! +
+
+
+
+ 파일추가 + 목록으로 + 저장하기 + 삭제하기 + + <%@ include file="/WEB-INF/include/include-body.jspf" %> + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/boardWrite.jsp b/src/main/webapp/WEB-INF/jsp/sample/boardWrite.jsp new file mode 100644 index 0000000..3443953 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/boardWrite.jsp @@ -0,0 +1,97 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + +<%@ include file="/WEB-INF/include/include-header.jspf" %> +Insert title here + + +
+ + + + + + + + + + + + + + + +
게시글 작성
제목
+ +
+ + +
+

+ + 삭제 +

+
+

+ 파일추가 + 작성하기 + 목록으로 +
+ + <%@ include file="/WEB-INF/include/include-body.jspf" %> + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/sample/kk.jsp b/src/main/webapp/WEB-INF/jsp/sample/kk.jsp new file mode 100644 index 0000000..68fbafa --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/sample/kk.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=EUC-KR" + pageEncoding="EUC-KR"%> + + + + +Insert title here + + +kkkk + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/home.jsp b/src/main/webapp/WEB-INF/views/home.jsp new file mode 100644 index 0000000..d1f8a0f --- /dev/null +++ b/src/main/webapp/WEB-INF/views/home.jsp @@ -0,0 +1,15 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ page session="false" %> + + + Home + + +

+ Hello world! +

+ +

The time on the server is ${serverTime}.

+ + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..24fb0e2 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,52 @@ + + + + + index.jsp + + + + encodingFilter + + org.springframework.web.filter.CharacterEncodingFilter + + + encoding + utf-8 + + + + encodingFilter + *.do + + + + org.springframework.web.context.ContextLoaderListener + + + + action + + org.springframework.web.servlet.DispatcherServlet + + + contextConfigLocation + + /WEB-INF/config/*-servlet.xml + + + 1 + + + action + *.do + + + + + contextConfigLocation + classpath*:config/spring/context-*.xml + + \ No newline at end of file diff --git a/src/main/webapp/css/ui.css b/src/main/webapp/css/ui.css new file mode 100644 index 0000000..d317aac --- /dev/null +++ b/src/main/webapp/css/ui.css @@ -0,0 +1,23 @@ +@CHARSET "UTF-8"; + +a:link, a:visited {text-decoration: none; color: #656565;} + +.board_list {width:100%;border-top:2px solid #252525;border-bottom:1px solid #ccc} +.board_list thead th:first-child{background-image:none} +.board_list thead th {border-bottom:1px solid #ccc;padding:12px 0 13px 0;color:#3b3a3a;vertical-align:middle} +.board_list tbody td {border-top:1px solid #ccc;padding:10px 0;text-align:center;vertical-align:middle} +.board_list tbody tr:first-child td {border:none} +.board_list tbody td.title {text-align:left; padding-left:20px} +.board_list tbody td a {display:inline-block} + +.board_view {width:30%;border-top:2px solid #252525;border-bottom:1px solid #ccc} +.board_view tbody th {text-align:left;background:#f7f7f7;color:#3b3a3a} +.board_view tbody th.list_tit {font-size:13px;color:#000;letter-spacing:0.1px} +.board_view tbody .no_line_b th, .board_view tbody .no_line_b td {border-bottom:none} +.board_view tbody th, .board_view tbody td {padding:15px 0 16px 16px;border-bottom:1px solid #ccc} +.board_view tbody td.view_text {border-top:1px solid #ccc; border-bottom:1px solid #ccc;padding:45px 18px 45px 18px} +.board_view tbody th.th_file {padding:0 0 0 15px; vertical-align:middle} + +.wdp_90 {width:60%} +.btn {border-radius:3px;padding:5px 11px;color:#fff !important; display:inline-block; background-color:#6b9ab8; border:1px solid #56819d;vertical-align:middle} +.pad_5 {padding: 5px} \ No newline at end of file diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..ad05442 --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=EUC-KR" + pageEncoding="EUC-KR"%> + + + + +Insert title here + + + + + \ No newline at end of file diff --git a/src/main/webapp/js/._common.js b/src/main/webapp/js/._common.js new file mode 100644 index 0000000..b32f778 Binary files /dev/null and b/src/main/webapp/js/._common.js differ diff --git a/src/main/webapp/js/common.js b/src/main/webapp/js/common.js new file mode 100644 index 0000000..0ee9411 --- /dev/null +++ b/src/main/webapp/js/common.js @@ -0,0 +1,179 @@ +function gfn_isNull(str) { + if (str == null) return true; + if (str == "NaN") return true; + if (new String(str).valueOf() == "undefined") return true; + var chkStr = new String(str); + if( chkStr.valueOf() == "undefined" ) return true; + if (chkStr == null) return true; + if (chkStr.toString().length == 0 ) return true; + return false; +} + +/** + * 공통 서브밋 객체 (Target/Popup 대응 버전) + */ +function ComSubmit(opt_formId) { + this.formId = (typeof opt_formId === "undefined" || opt_formId === null || opt_formId === "") ? "commonForm" : opt_formId; + this.url = ""; + this.target = "_self"; // 기본값은 현재 창 + + var $targetForm = $("#" + this.formId); + + // [1] 초기화: commonForm일 경우 내부를 비우고 target도 기본값으로 리셋 + if ($targetForm.length > 0 && this.formId === "commonForm") { + $targetForm.empty(); + $targetForm.attr("target", "_self"); // 이전 타겟 설정 제거 + } + + this.setUrl = function setUrl(url) { + this.url = url; + }; + + /** + * [2] 타겟 설정 (팝업창 이름이나 _blank 등) + */ + this.setTarget = function setTarget(target) { + this.target = target; + }; + + this.addParam = function addParam(key, value) { + if ($targetForm.length === 0) return; + var $existingParam = $targetForm.find("input[name='" + key + "']"); + + if ($existingParam.length > 0) { + $existingParam.val(value); + } else { + var inputHtml = $("", { type: "hidden", name: key, id: key, value: value }); + $targetForm.append(inputHtml); + } + }; + + /** + * [3] 서버 전송 + */ + this.submit = function submit() { + if ($targetForm.length === 0) return; + + var frm = $targetForm[0]; + if (!this.url) { + alert("전송할 URL이 설정되지 않았습니다."); + return; + } + + frm.action = this.url; + frm.method = "post"; + frm.target = this.target; // 설정된 타겟 적용 + frm.submit(); + }; +} + + var gfv_ajaxCallback = ""; + + function ComAjax(opt_formId) + { + this.url = ""; + this.formId = gfn_isNull(opt_formId) == true?"commonForm":opt_formId; + this.param = ""; + + if(this.formId == "commonForm") + { + var frm = $("#commonForm"); + if(frm.length>0){ + frm.remove(); + } + + var str = "
"; + $('body').append(str); + } + + this.setUrl = function setUrl(url) + { + this.url = url; + }; + + this.setCallback = function setCallback(callBack) + { + fv_ajaxCallback = callBack; + }; + + this.addParam = function addParam(key, value) + { + this.param = this.param + "&" + key + "=" + value; + }; + + this.ajax = function ajax() + { + if(this.formId != "commonForm"){ + this.param += "&" + $("#" + this.formId).serialize(); + } + $.ajax({ + url : this.url, + type : "post", + data : this.param, + async : false, + success : function(data, status){ + if(typeof(fv_ajaxCallback) == "function"){ + fv_ajaxCallback(data); + }else{ + eval(fv_ajaxCallback + "(data);"); + } + } + }); + }; + } + + //페이징 태그부분 + /* + * divId : 페이징 태그가 그려질 div + * pageIndx : 현재 페이지 위치가 저장될 input 태그 id + * recordCount : 페이지당 레코드 수 + * totalCount : 전체 조회 건수 + * eventName : 페이징 하단의 숫자 등의 버튼이 클릭되었을때 호출될 함수 이름 + */ + + var gfv_pageIndex = null; + var gfv_eventName = null; + + function gfn_renderPaging(params) + { + var divId = params.divId; //페이징이 그려질 div id + gfv_pageIndex = params.pageIndex; //현재 위치가 저장될 input 태그 + var totalCount = params.totalCount; //전체 조회 건수 + var currentIndex = $("#"+params.pageIndex).val(); //현재 위치 + if($("#"+params.pageIndex).length == 0 || gfn_isNull(currentIndex) == true){ + currentIndex = 1; + } + + var recordCount = params.recordCount; //페이지당 레코드 수 + if(gfn_isNull(recordCount) == true){ + recordCount = 20; + } + + var totalIndexCount = Math.ceil(totalCount/recordCount); //전체 인덱스 수 + gfn_eventName = params.eventName; + /* + * Math.floor : 소수점 버림 + * Math.ceil : 소수점 올림 + * Math.round : 반올림 + * Math.random : 랜덤함수 + * Math.sqrt : 제곱근 + * Math.pow : 제곱 + * Math.abs : 절대값 + */ + + $("#"+divId).empty(); + var preStr = ""; + var postStr = ""; + var str = ""; + + var first = (parseInt((currentIndex-1)/10)*10) + 1; + var last = (parseInt(totalCount/10)==parseInt(currentIndex/10))?totalIndexCount%10:10; + var prev = (parseInt((currentIndex-1)/10)*10) - 9 > 0 ? (parseInt((currentIndex-1)/10)*10) - 9 : 1; + var next = (parseInt((currentIndex-1)/10)+1) * 10 + 1 < totalIndexCount ? (parseInt((currentIndex-1)/10)+1) * 10 + 1 : totalIndexCount; + + if(totalIndexCount>10){ + preStr += "[<<]" + } + + + } \ No newline at end of file