IDEA的安装、注册码、创建项目、配置环境、配置Struts2模块、Debug使用、十大特征,Eclipse及IntelliJ IDEA的xml文件的创建

版权声明:本文为博主原创文章,未经博主允许不得转载。谢谢合作~ https://blog.csdn.net/qq_41042595/article/details/85247375

最近同学,很多都在使用IntelliJ IDEA编辑器,我也跟着换个工具来,但将IDEA安装(在最后部分,有相关链接,可以直接点击蓝色,直接跳转)后,我还是继续使用JDK1.7,虽然听他们说自己都改用JDK1.8,可是我百度,也见有人使用JDK1.7加上Tomcat7.0或者8.0,还有的是我安装了Tomcat8.0,但是使用Tomcat7.0,(IDEA很卡,但是很方便)

所以我的环境配置:JDK1.7+Tomcat7.0

学完Spring、MyBatis之后,学SpringMVC;因此我在IDEA中新建项目,该配的环境都去配,该引入的jar包都引入,接着在src下加包,

接着想去New个XML文件到"mapper"包下或者"src"下,发现没有"New 基本模板的XML",不像Eclipse中创建Xml文件,

①以下为Eclipse创建XML文件(是除了直接拷贝黏贴XML文件的另一种方法):

 

---------------------以下若有错误,请及时告诉我,我好纠正,谢谢~.~-------------------------

【在Eclipse中导入或添加DTD文件】

---------------------使用第三种方式Create Xml File From an Xml Template的结果--------------

② 以下为IDEA中创建XML文件:

 打开路径主要有两条

⑴  一:

⑵  二:

——⑴接下来我主要以第一种路径方式来讲,因为第二种路径进去添加也是差不多的

_________*******MyBatis-config.xml******___________
[自定义的MyBatis配置文件模板]

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>

</configuration>

_____________*******XxxDAO.xml*******_____________
[自定义的Mapper配置文件模板]

<?xml version="1.0" encoding="UTF-8" ?>
<!-- mybatis的dtd文件 -->
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--namespace属性: 用于指定指向那个接口 -->
<mapper namespace="com.ht.mapper.AxxDAO">

</mapper>

___________*******Spring-config.xml*******_____________
[IDEA有默认New该Spring配置文件的模板]

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">

</beans>

            ——————————spring-service.xml(或者spring-dao.xml)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

</beans>

            ——————————spring-web.xml
[相对多了xmlns:mvc]

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

</beans>

            ——————————application.xml
[其实就是spring配置的Xml文件嘛!!!相对多了xmlns:aop,而xmlns:tx的值可能有多余,无用时可删除,多余删除后,有时可用为:import-hbm.xml、datasource-context.xml、applicationContext.xml]

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd">

</beans>

            ——————————service-config.xml

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

</service-config>


______________******struts.xml********________________
[一般拷贝进去,但应该也可以自己配置 或者 创建新项目时除了勾选Web Application也勾选Struts??!!?!(不过我的没有Struts模块或组件,可以去配置,在 最后部分 哦!!!)]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>

</struts>

_____________*********hibernate.cfg.xml*******__________________
[一般拷贝黏贴]

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>

</hibernate-configuration>

 ③最后

安装时找到的“讲解详细的文章【IntelliJ IDEA安装及破解】”

安装之后,打开软件,要注册码(使用正版更好些嘛)的话看这篇文章【IDEA2018.1.1版本破解】(如果在第一步的“修改C:\Windows\System32\drivers\etc\hosts 文件”中,修改之后保存不了,可以试着下载NotePad++软件,用该软件打开文件并修改保存,一定成功,我就是遇到这样的情况了哈哈~)

⒊或者这篇文章的注册码【IntelliJ IDEA2018.3 最新破解方法 亲测可用】

注册之后,导入Tomcat的Jar包、创建WebProject、引入Tomcat、简单的Servlet实现【IDEA新建javaWeb以及Servlet简单实现】

⒌ 若你不想看1、2 或3、4,可以看这个: 这1 、2或3、4的大概,即,总体上主要的都有了【Windows7下安装与破解IntelliJ IDEA2017】

(这里有个关于IDEA的PDF文件(我也是找别人的),有"详细讲解Setting、Maven安装与使用、快捷键、引入GitHub或Git等")

Maven简单使用(主要看这个才去点吧,后面那个我已经说过了)和创建Spring配置文件的路径【IDEA中配置 和创建spring.xml】

就是看了这篇文章,解决我的问题,并且我写出这篇文章(我觉得,我的更全面!!!)【IntelliJ IDEA中创建xml文件】

⒏调试debug详细讲解,个人认为比原创更详细【IDEA:Debug使用详解(含2018版特性)】

⒐看到这里,想要详细看图而且用中文讲解 “ 创建项目、Tomcat服务配置、setting中修改字体或风格或拼写检查、常用快捷键 ” 的,可以看这篇【IDEA快捷键以及初次使用配置】

了解——1【IntelliJ IDEA 2017 的十大特性(1)】、了解——2【IntelliJ IDEA 2017 的十大特性(2)】、了解——3【IntelliJ IDEA 2017 的十大特性(3)

⒒若使用Struts2框架,当创建项目时,Java Enterprise选项卡没有Struts模块,这可以看这篇文件【如何在Intellij IDEA中创建struts2模块】

⒓或者【从零开始用Intellij idea14创建struts2项目】

猜你喜欢

转载自blog.csdn.net/qq_41042595/article/details/85247375
今日推荐