2011. 7. 13. 17:31

Dynamic Web Module 버전(j2ee 스펙)에 따라 EL 의 사용가능과 설정이 다르다.

EL는 기본적으로 2.4 이상부터 사용가능하지만 2.4 스팩에서는 default 로 EL을 무시하는게 true 로 설정되어있다.

그래서 따로 설정을 잡지 않는 이상은 EL를 아무리 찍어도

${member.name}

식으로 브라우저에 그대로 내용이 찍혀버린다.

2.4 일 경우 web.xml 에

<web-app version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >

로 설정하면 EL을 사용가능하며, 2.5 일 경우 
<web-app version="2.5" 
         xmlns="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         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_2_5.xsd">

로 설정해주면된다. eclipse 로 개발하는 경우 dynamic web module 을 2.5 잡을 경우엔 신경쓸 필요가 없지만

2.4로 잡을 땐 web.xml 이 위의 설정처럼 나오지 않을 수 있다. 그 때는 xml 에 위와같이 설정해주면

모든 jsp 에서 EL 을 사용가능하고 각각의 jsp 마다 설정하는 것을 원한다면 상단에 

<%@page isELIgnored="false"%>

를 적어주면 된다.

'Java SE > java' 카테고리의 다른 글

Java Decompiler  (0) 2011.12.14
POI에서 Excel업로드 할 시 문제점 - Row count  (2) 2011.11.22
jad (java decompiler)  (0) 2011.03.16
java.lang.IllegalStateException: getOutputStream() has already been called  (0) 2011.03.16
java.lang.Clone  (0) 2011.03.16
Posted by silver0r