MAVEN Create WebApp Project

Source: Internet
Author: User

First, eclipse configuration

1. Eclipse integrates the user's own installed JDK

2. Eclipse integrates user-installed Maven

3. Eclipse integrates user-installed Tomcat

4. Remove spell

5, modify the font small four



Ii. maven Create WebApp Project


New-->other-->maven project->use Default Workspace location (select working directory without naming the project folder)--

Maven-archetype-webapp--> definition Artifactid,maven Creates a folder based on Artifactid in the working directory to hold the project




1, solve Jsp-api and SERVLET-API related jar not classpath path, cause servlet and JSP error problem

Project-Right-click Properties-->project facts-->runtimes (right), select the configured tomcat, configure the user's own Tomcat in Ecipse--> properties-->server



2, the development of Java EE Project, with Java EE view, easy to find Web. XML and JSP files, in the deployed resources can be easily found


3. Change the web.xml,jsp template, add jstl dependencies, change the JUnit version

<dependencies>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.12</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>javax.servlet</groupId>

<artifactId>jstl</artifactId>

<version>1.2</version>

</dependency>

</dependencies>



JSP page Template

<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "

pageencoding= "UTF-8"%>

<%@ taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"%>

<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">

<title></title>

<body>

<form action= "${pagecontext.request.contextpath}/#" method= "POST" >

</form>

</body>




Web. XML template



<?xml version= "1.0" encoding= "UTF-8"?>

<web-app version= "2.5" xmlns= "Http://java.sun.com/xml/ns/javaee"

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 ">

</web-app>



4. Create src Directory

Locate the SRC directory of the project, build the Java directory under the main folder, and build the Test/java,test/resources directory under SRC

Right-click Project Properties, Java Build path, tick test/resources, and adjust the order in which each directory is displayed.



5. Convert the MAVEN project module to 2.5


1, filters, do not filter. resources file

. Settings folder

Org.eclipse.wst.common.component.xml---> project-version= "1.6.0" >

Org.eclipse.wst.common.project.facet.core.xml-->installed facet= "Jst.web" version= "2.5"/>


6. Import all kinds of theme templates

http://eclipsecolorthemes.org/


7. Integrate Tomcat in eclipse to deploy the project



8. MAVEN automatically releases the project to Tomcat



This article from "Small Fish Blog" blog, declined reprint!

MAVEN Create WebApp Project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.