[JSP] ch02-02. declaration
·
WEB/JSP
2-2. declaration 더하기 +=
[JSP] ch02-01. scriptlet
·
WEB/JSP
2-1. scriptlet(스크립트릿) 디렉티브 --%> 더하기 + = + =
[JSP] ch01-04. LifeCycle
·
WEB/JSP
1-4. LifeCycle @WebServlet("/ch01/ex04/lifecycle") public class LifeCycle extends HttpServlet { private int initCnt = 0; private int doGetCnt = 0; private int destroyCnt = 0; public void init(ServletConfig conf) throws ServletException{ System.out.printf("intiCnt: %d\n", ++initCnt); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExcept..
[JSP] ch01-03. 서블릿 클래스 GET, POST 방식
·
WEB/JSP
1-3. 서블릿 클래스 Get, Post방식 전송 @WebServlet("/ch01/ex03/home/add") public class DoGetPost extends HttpServlet { private static final long serialVersionUID = 1L; public void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int num1 = 1; int num2 = 2; response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out...
[JSP] ch01-02. 서블릿 클래스 POST 방식
·
WEB/JSP
1-2. 서블릿 클래스 Post방식 전송 @WebServlet("/ch01/ex02/add") public class DoPost extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int num1 = 1; int num2 = 2; response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out.println("PO..
[JSP] ch01-01. 서블릿 클래스 GET 방식
·
WEB/JSP
1-1. 서블릿 클래스 Get방식 전송 @WebServlet("/ch01/ex01/add") public class DoGet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int num1 = 1; int num2 = 2; response.setContentType("text/html.charset=utf-8"); PrintWriter out = response.getWriter(); out.println("GET")..
[SPRING] 스프링과 마이바티스 에서 다중 데이타소스 사용하기
·
FrameWork/Spring
Spring 과 MyBatis (iBatis) 를 개발 환경으로 사용할 경우 여러 개의 datasource 를 써야 되는 경우가 있다. 여러 개의 data source 에 연결해야 할 경우 Mybatis config와 mapper 를 별도의 패키지로 분리하는게 개인적으로는 관리가 용이하다. 단위 테스트 및 stand-alone 용이라 Data Source 설정이 WAS에 있지 않고 spring context 에 있고 BoneCP 나 c3p0 같은 Connection Pool 을 사용하지 않고 스프링의 SimpleDriverDataSource 로 설정되어 있다. database-context.xml 이 상태로 어플리케이션을 구동하면 다음과 비슷한 에러가 발생하고 디플로이가 안 될 것이다. Ignoring ..
[LINUX] samba서버 설정
·
공지사항
단된 포트를 우회하기 위해서는 아래 두 가지 방법이 대표적이다. 1. 다른 포트를 사용하여 smb 구성하는 방법 - 서버와 클라이언트 모두 포트 리다이렉션 설정 필요 - 다이렉트로 연결되기 때문에 속도가 빠름 2. ssh 터널링으로 smb 연결하는 방법 - 윈도우(smb 클라이언트)만 설정 필요 - 속도가 상대적으로 느리지만 소스코드 편집 목적이라면 불편함 없음 - smb 접속을 위해 ssh 연결 유지해야 함 리눅스 1. 삼바 설치 및 설정 # sudo yum install samba # sudo vi /etc/samba/smb.conf [global] workgroup = WORKGROUP [ec2-user] comment = my ec2 public path = /home/ec2-user public..
[Spring, JAVA] 파일 복사(FileChannel 이용)
·
FrameWork/Spring
방식은 이러합니다. SQL 쿼리문에서 파일정보를 가져옵니다. saveNm과 fileNm 매칭하여 리스트들을 불러와 FileChannel객체를 이용하여 파일을 카피합니다. 이 방법이 local파일 카피속도는 제일 빠르다.(제 생각..) filecopy 메소드에서 경로를 잘지정하고 DB에서 saveNm과 fileNm만 잘 가지고 오면된다. Controller.java @RequestMapping(value = "/fileDownloadY.do", method = RequestMethod.GET) public void filedownloadY(HttpServletRequest request, HttpServletResponse response , @RequestParam(value="approval", req..
[SPRING] ch04. 로그인
·
SKILL/Security
PwController.java package secure.ch04.ex01.controller; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/ch04/ex01/pw"..
[SPRING] ch03. OS 명령어
·
SKILL/Security
package secure.ch03.ex01.controller; import java.io.IOException; import java.io.InputStream; import java.util.Scanner; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springfr..
[SPRING] ch02. SQL Injection - 방어
·
SKILL/Security
* 에러 페이지를 준비해서, DB 관련 오류 메세지가 브라우저에 노출되지 않도록 한다.a /WEB-INF/web.xml (수정) 500 /error MainController.java package secure.ch02.ex01.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller("ch02.ex01.mainController") public class MainController { @RequestMapping("/error") public String error(){ return "ch02/ex01/error"; ..