(Turn) Maven cannot modify the web version when creating a webapp project

The web app created by maven uses servlet version 2.3 by default, which does not support JSTL by default. In order to support JSTL expressions by default, the servlet needs to be upgraded to 3.0

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

After the maven plugin is installed in eclipse, sometimes when a new webapp project is created, the version of the project is the old version of 2.3.
  
  

If you want to modify this version, the first method: select the project, right-click, and then click Properties, the following dialog box will pop up

 

 

​Click on Project Facets, as shown in the figure:

  

Click the downward triangle arrow next to java, select 1.7, click the downward triangle arrow next to Dynamic Web Module, select 2.5 or 3.0, and finally click apply.

Appeal methods sometimes do not work, if not, use the following methods:

Method 2: Click Windows --> show view-->navagator on the menu

In this way, the project can be displayed through navagator, as shown in the figure: 

  

Create a web.xml file under the src -> main -> webapp

-> WEB-INF directory

. If it already exists, you do not need to create it, as shown in the figure: 

  

1. In the web.xml file, add the following code:

<?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. Open the org.eclipse.wst.common.project.facet.core.xml file and change the code to:

​<?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> 

At this point, after returning to Method 1, it is found that the version of the web can be modified

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325061736&siteId=291194637