码迷,mamicode.com
首页 > 其他好文 > 详细

Intellij Idea + Maven + Git + Struts2 HelloWorld

时间:2015-12-29 14:40:32      阅读:697      评论:0      收藏:0      [点我收藏+]

标签:

1、在intellij Idea上新建Maven项目,输入相应的groupId,artifactId,项目名称:

技术分享

技术分享

技术分享

2、在项目的pom文件中,引入struts2的核心依赖struts2-core:

<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.24.1</version>

技术分享

3、在java文件夹下,新建struts2.xml文件

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

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
</struts>

4、点击F4 或右击项目,点击Open Module Setting,如下图:

技术分享

5、给项目添加web框架,点击Modules,然后点击绿色加号,在FrameWork选择Web:

技术分享

6、为项目添加struts2模板,点击Facets

技术分享

技术分享

7、添加项目输出的jar包

技术分享

技术分享

8、在web下新增index.jsp文件,内容如下:

<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2015/12/29
Time: 13:52
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body>
Hello World
</body>
</html>

9、配置tomcat,点击Run下的Edit Configuration,命名,然后添加Deployment:

技术分享

技术分享

10、启动tomcat,在浏览器中输入http://localhost:8080/

技术分享

 

Intellij Idea + Maven + Git + Struts2 HelloWorld

标签:

原文地址:http://www.cnblogs.com/hklv/p/5085529.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!