Skip to content

Instantly share code, notes, and snippets.

@enujo
enujo / servlet-context.xml
Created January 13, 2017 04:39
transaction을 위한 빈추가
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">
@enujo
enujo / pom.xml
Created January 13, 2017 04:30
Spring mySQL myBatis 의존성 주입
<!-- mysql connector 추가 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.40</version>
</dependency>
<!-- 스프링에서 JDBC 사용을 위한 spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
package com.tistory.luahius;
public class Math {
public int MyMath(int x, int y){
return x+y;
}
public static void main(String[] args){
Math m = new Math();
@enujo
enujo / web.xml
Created January 6, 2017 07:50
spring mvc insert
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
@enujo
enujo / BoardMapper.xml
Created January 6, 2017 07:11
spring mvc insert
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tistory.luahius.BoardMapper">
<insert id="boardAdd" parameterType="com.tistory.luahius.service.Board">
INSERT INTO board(
board_pw,
board_title,
board_content,
board_user,
@enujo
enujo / servlet-context.xml
Created January 6, 2017 07:08
spring mvc insert
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
@enujo
enujo / BoardDaoImpl.java
Created January 6, 2017 06:58
spring mvc insert
package com.tistory.luahius.service;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@Repository
public class BoardDaoImpl implements BoardDao{
@Autowired
@enujo
enujo / BoardDao.java
Created January 6, 2017 06:57
spring mvc insert
package com.tistory.luahius.service;
public interface BoardDao {
int insertBoard(Board board);
}
@enujo
enujo / BoardServiceImpl.java
Created January 6, 2017 06:57
spring mvc insert
package com.tistory.luahius.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BoardServiceImpl implements BoardService{
@Autowired
private BoardDao boardDao;
@enujo
enujo / BoardService.java
Created January 6, 2017 06:54
spring mvc insert
package com.tistory.luahius.service;
public interface BoardService {
int addBoard(Board board);
}