2012-09-29 62 views
2

我使用Apache Maven 3創建了一個Eclipse Web項目。我遇到了表達式語言的問題。它默認是禁用的,我嘗試通過web.xml啓用它是徒勞的。在maven項目中EL被默認禁用

<jsp-config> 
    <jsp-property-group> 
    <url-pattern>*.jsp</url-pattern> 
    <el-enabled>true</el-enabled> 
    <scripting-enabled>true</scripting-enabled> 
    </jsp-property-group> 
</jsp-config> 

我能夠使它們工作的唯一方法就是在JSP頁面上使用這個scriptlet。

<%@ page isELIgnored="false" %> 

爲我的項目的POM如下:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>learn.filter</groupId> 
    <artifactId>LearnFilters</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>LearnFilters Maven Webapp</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
    <groupId>jstl</groupId> 
    <artifactId>jstl</artifactId> 
    <version>1.2</version> 
</dependency> 


    </dependencies> 
    <build> 
    <finalName>LearnFilters</finalName> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.tomcat.maven</groupId> 
      <artifactId>tomcat6-maven-plugin</artifactId> 
      <version>2.0</version> 
      <configuration> 
      <port>8080</port> 
      <path>/LearningFilters</path> 
       <warFile>${project.basedir}/target/${project.build.finalName}.war</warFile> 
      </configuration> 
     </plugin> 
     <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
    </plugins> 
    </build> 
</project> 

有什麼辦法,我可以通過web.xml中或在默認情況下啓用?此外,這種構建創建兩個web.xmls!這變得非常混亂。請指教。

+0

你在Eclipse中安裝了m2e-wtp插件嗎? – khmarbaise

+0

不....我還沒有使用任何插件。 –

回答

1

你的web.xml版本是什麼?在2.4 AFAIK中默認爲isELIngnored。所以使用2.5或3.0命名空間,一切都會好的。