디자인 패턴 책을 보던 중 새로운 사실을 알게 되었다.
for/in이라는 선언문이 자바 5 부터 추가되었다는 내용이다.
for/in 선언문은 collection 류의 객체들과 배열에 대해서
편리하게 순환문(반복문)을 돌릴 수 있게 해준다.
형식은 다음과 같다.
for(Object obj: collection) {
...
}
단, 컬렉션은 제네릭을 사용하여 어떤 객체를 담는 컬렉션인지 명시해야한다.
ArrayList<Movie> movieList = (ArrayList<Movie>)getMovieList();
for(Movie movie: movieList) {System.out.println("Movie Name is : " + movie.getName() );
}
이런 식으로 말이다.
예전 C#을 잠깐 공부할때 유사한 문법을 본적있는데 역시 자바에도 존재하였다.
좀 더 편리하게 코딩을 할 수 있을 듯.
'작업노트 > JAVA' 카테고리의 다른 글
| Java TimeZone 관련 링크 (0) | 2009.07.17 |
|---|---|
| CSV파일 (0) | 2009.03.02 |
| Java API Map (0) | 2008.01.05 |
| JVM 메모리구조와 스택 - 참조 ^^ (0) | 2007.11.19 |
| 자바에서 swap 구현하기 (0) | 2007.11.19 |
URI(Uniform Resource Identifier)은 자원을 참조할 때 각 자원의 식별을 나타내기 위한 일종의 규약이다.
URL(Uniform Resoruce Locator)과 URN(Uniform Resoruce Name)은 URI를 표현하기 위한 한 방법이다.
URL은 자원의 위치정보를 이용해서 표현하는 방식이고(일반 인터넷 주소를 생각하면 됨),
URN은 고유의 이름으로 식별하는 방법이다(온라인 서점에서 책살때 볼수 있는 ISBN같은 것).
아주 약간더 자세한 설명은 아래 포스트 참조.
http://blog.naver.com/wikiware?Redirect=Log&logNo=100019145703
http://ez2web.com/blog/read.asp?seqPost=87
이 글은 스프링노트에서 작성되었습니다.
'거미줄세상' 카테고리의 다른 글
| 구글 어스 (0) | 2008.05.31 |
|---|---|
| 블로그 코리아, 블로거 간담회에 다녀왔어요. (4) | 2008.03.15 |
| 제9회 한국 자바 개발자 컨퍼런스 (0) | 2008.02.03 |
| [담아온글] 자바 웹 프로그래머의 기본 (0) | 2007.12.22 |
| 창조경영!! 기업블로그로 무장하라 - (주) 네트빌 (0) | 2007.12.20 |
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
| 작업노트/Error Handling 2008. 2. 19. 15:53HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 22 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
netville.servlet.filter.EncodingFilter.doFilter(EncodingFilter.java:53)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
servlet-api.jar의 버전이 안맞아 jsp파일을 컴파일 시키지 못해서
(또는 컴파일이 된곳을 찾지 못하여)
발생하는 에러인 듯하다.(정확히 아는 분이 계시면 말씀 바람.)
확인은 안해봤지만, Tomcat6이상에서만 나는 듯하다.
jdk 5.0을 C드라이브 루트 폴더에 다시 설치하고 컴퓨터 환경변수에서 JAVA_HOME을 변경된 경로로 수정하고, 이클립스의 Preferences ->java->installed JREs 에서 새로운 jdk의 경로로 location을 잡은 후 실행시키니 잘 돌아간다..
(필요없는 환경변수는 다 지웠다. 오로지 JAVA_HOME만 남겨둔채..
이클립스로 개발만 할 때에는 다른 환경변수는 필요치 않다.)
환경변수 설정할때 경로에 빈공간(Space)가 들어가면 문제가 발생할 수도 있다고 한다..
이전 JAVA_HOME의 경로는 'Program Files' 안에 있었는데,
그게 문제 인건지도 모르겠다.
* 잘못된 내용 태클 환영입니다.
이 글은 스프링노트에서 작성되었습니다.
'작업노트 > Error Handling' 카테고리의 다른 글
| [iBatis]UncategorizedSQLException (0) | 2008.07.07 |
|---|---|
| Context [] startup failed due to previous errors.... 등등; (0) | 2008.05.29 |
| [Eclipse] JVM terminated. Exit code=-1 ....................................... (3) | 2007.12.23 |
| [JNDI] NamingException (0) | 2007.12.22 |
| [Eclipse] Resource is out of sync with the file system : ... (1) | 2007.12.18 |


