MongoDB


DataBase 는 DB 그대로 이고

Table의 개념은 Collection 이다.


ex)  db = kim  table = student  라는 예제로 테이블 접근.

use kim

db.student.find();


db를 사용하기위해선 use 데이터베이스명

검색이나 삭제를 하기위해선 db.콜렉션명.find();


블로그 이미지

김진리

,

현재 Spring maven 에 tomcat lib 를 추가하여 생기는 에러이다.

2가지 방법이 있다.


첫번째.

http://stackoverflow.com/questions/8487048/java-lang-linkageerror-javax-servlet-jsp-jspapplicationcontext-getexpressionfac  글 참고

That will happen when you include server-specific libraries of a different server make/version in the/WEB-INF/lib of your web application, such as jsp-api.jarel-api.jarservlet-api.jar, etc. You need to remove them all. The /WEB-INF/lib should not contain any server-specific libraries. They belongs in the specific server itself (Tomcat has them in its /lib folder already).


자신의 톰캣 서버의 lib를 사용하면 에러가 나지 않는다.

Project -> Properties -> JAVA Build Path -> Libraries -> Add Library -> Server Runtime

Server 추가 한다.



두번째.


pom.xml 에 


<dependency>

<groupId>org.apache.tomcat</groupId>

<artifactId>tomcat-coyote</artifactId>

<version>7.0.39</version>

<scope>provided</scope>

</dependency>



provided - 컴파일 할 때 필요하지만, 실제 런타임 때에는 컨테이너 같은 것에서 기본으로 제공되는 모듈임을 의미한다. 예를 들어, 서블릿이나 JSP API 등이 이에 해당한다. 배포시 제외된다.

 

실제 런타임때에는 컨테이너(JVM)에서 제공되는 api 를 사용해야 하기 때문에 provided 를 사용한다.

ex) tomcat 안에 있는 jar 파일들

'개발자 > Spring' 카테고리의 다른 글

Spring 에서 File Dowload 하는 예제 및 설정  (0) 2013.06.12
스프링 프레임웍 jar 파일  (1) 2013.03.05
Spring 에서 context부분...  (0) 2013.03.04
Spring 기본 환경설정 프로젝트  (0) 2013.03.04
applicationContext.xml  (0) 2013.03.04
블로그 이미지

김진리

,

java 에서 httpclient 를 이용하여 데이터를 보낼시 한글이 ?? 로 깨지는 경우가 발생한다.


한글 처리는 java.net 의 URLEncoder 와 URLDecoder 를 이용해 보낼땐 encode, 받을땐 decode 를 하면 한글이 정상 처리됨을 볼 수 있다.


httpclient file post 방식 예제 )


PostMethod post  = new PostMethod("보낼경로");

String filename = URLEncoder.encode("파일이름");

File file = new file(파일경로);

Part[] parts = { new StringPart("보낼 속성 이름",filename),

new FilePart("보낼 속성 이름",file)

};


post.setRequestEntity( new MultipartRequestEntity(parts,filePost.getParams()));

HttpClient client = new httpClient();

int status = client.executeMethod(post);  <- 실제적으로 경로를 실행하게되고 상태 값이 int status 에 저장하게 된다 200 이 return 되면 성공 404 는 페이지를 찾을수 없다


if( status == HttpStatus.SC_OK) {
    200

}






받을시


String temp = URLDecoder.decode( request.getparameter("속성이름"));

한글 파일 이름이 저장이 된다.

블로그 이미지

김진리

,