首页 文章

IntelliJ和Tomcat .. Howto ..?

提问于
浏览
99

使用Netbeans,我开发了Tomcat作为本地服务器来管理它的站点 . 在Netbeans中,它是“安装,写入命中运行,它的工作原理”如何在IntelliJ中取消相同的操作?

我无法找到这方面的分步说明 .

7 回答

  • 13

    NOTE: Community Edition不支持JEE .

    首先,您需要安装本地Tomcat服务器 . 听起来你可能已经这样做了 .

    接下来,在IntelliJ顶部的工具栏上,单击“运行”和“调试”图标左侧的向下箭头 . Edit Configurations 会有一个选项 . 在弹出的结果中,单击“添加”图标,然后单击“Tomcat”和“本地” .

    在该对话框中,您需要单击Application Server旁边的Configure ...按钮以告知IntelliJ Tomcat的安装位置 .

  • 16

    以下是IntellijIdea中Tomcat配置的分步说明:

    1)通过WebApplication模板创建IntellijIdea项目 . Idea应该是Ultimate版本,而不是Community版本

    enter image description here

    2)转到Run-Edit configutaion并设置Tomcat位置文件夹,以便Idea知道你的tomcat服务器
    enter image description here

    3)转到“部署”选项卡,然后选择“工件” . 申请
    enter image description here

    4)在src文件夹中放入你的servlet(你可以试试我的例子进行测试)
    enter image description here

    5)转到web.xml文件并像这样链接你的servlet

    enter image description here

    6)在web文件夹中放入你的.jsp文件(例如hey.jsp)

    enter image description here

    7)现在你可以通过IntellijIdea启动你的app . 运行(Shift F10)并在浏览器中享受您的应用:

    - to jsp files: http://localhost:8080/hey.jsp(默认情况下为index.jsp)

    - to servlets via virtual link you set in web.xml : http://localhost:8080/st

  • 1

    您使用的是哪个版本的IntelliJ?请注意,自去年以来,IntelliJ存在两个版本:

    • Ultimate Edition ,这是完整的IDE

    • Community Edition ,这是免费的,但不支持JavaEE开发 .

    (见差异here

    如果您使用 Community Edition ,您将无法管理Tomcat安装 .

    如果您使用 Ultimate Edition ,您可以查看:

  • 38

    您还可以使用社区版调试tomcat(与上述内容不同) .

    在调试模式下启动 tomcat ,例如: . \ catalina.bat jpda run

    intellij 中:运行>编辑配置>

    选择“远程”命名连接:“somename”设置“端口:”8000(默认为5005)

    选择“运行”>“调试”“somename”

  • 99

    请确认 Settings | Plugins 中已启用所需的插件,很可能是您没有看到所有构面选项的原因 .

    有关分步教程,请参阅:Creating a simple Web application and deploying it to Tomcat .

  • 37

    我遇到的问题是由于我在不知不觉中编辑默认值而根本不是新的Tomcat实例 . 单击“运行”窗口左上角的加号,然后选择“Tomcat”从那里当地 .

  • 5

    在Netbeans中,您可以右键单击项目并运行它,但在IntelliJ IDEA中,您必须选择index.jsp文件或欢迎文件来运行项目 .

    这是因为Netbeans在web.xml中生成以下标记,而IntelliJ则不生成 .

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    

相关问题