Maven建立webapp項目無法修改web版本的問題

來源:互聯網
上載者:User

標籤:code   middle   需要   servlet   tor   org   let   通過   web   

maven建立的web app,預設使用的servlet版本是2.3,預設不支援JSTL,為了預設支援JSTL運算式,需要升級servlet到3.0

轉:http://blog.sina.com.cn/s/blog_b03dd8950102wi05.html

eclipse中裝了maven外掛程式後,有時會出現建立webapp項目的時候,項目的版本是2.3的老版本,
  
  

想要修改此版本,第一種方法:選中項目,點擊右鍵,再點擊Properties,彈出如下對話方塊

 

 

?點擊 Project Facets ,

  

點擊java 旁邊的向下的三角箭頭,選擇1.7,在點擊Dynamic Web Module旁邊的向下的三角箭頭,選擇2.5或者3.0,最後點擊 apply 即可。

上訴方法有時候卻不行,如果不行,則要用如下方法:

方法二:點擊菜單上面的 Windows --> show view-->navagator

這樣就可以通過navagator來顯示項目, 

  

在src -> main ->webapp

-> WEB-INF 目錄下面建立

web.xml檔案,如果已存在則不需要建立, 

  

1,在web.xml檔案中,添加如下代碼:

<?xml version="1.0"

encoding="UTF-8"?>

<web-app

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"id="schedule-console"

version="3.0"></web-app>

2,開啟 org.eclipse.jdt.core.prefs

檔案,代碼改為:?eclipse.preferences.version=1org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabledorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7org.eclipse.jdt.core.compiler.compliance=1.7org.eclipse.jdt.core.compiler.problem.assertIdentifier=errororg.eclipse.jdt.core.compiler.problem.enumIdentifier=errororg.eclipse.jdt.core.compiler.problem.forbiddenReference=warningorg.eclipse.jdt.core.compiler.source=1.7?

3,開啟 org.eclipse.wst.common.project.facet.core.xml 檔案,將代碼改為:

?<?xml version="1.0"

encoding="UTF-8"?><faceted-project>

<fixed facet="wst.jsdt.web"/>

<installed facet="java"

version="1.7"/> <installed

facet="jst.web" version="3.0"/>

<installed facet="wst.jsdt.web"

version="1.0"/></faceted-project> 

此?時,在回到方法一,發現web的版本可以修改了

(轉)Maven建立webapp項目無法修改web版本的問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.