JSP debugging in IntelliJ IDEA

后端 未结 6 947
日久生厌
日久生厌 2020-11-30 21:31

Does anyone know how to debug JSP in IntelliJ IDEA?

When I set breakpoint in my JSP files, those breakpoints never seem to

6条回答
  •  -上瘾入骨i
    2020-11-30 22:08

    For remote JSP debugging (which also applies to localhost) you'll need to install the JSR45 ㄧ support plugin. Please note this feature is only supported in the Ultimate edition of IntelliJ, not the community edition.

    1. Go to Preferences > Plugins, search for the JSR45 plugin, and enable it.
    2. Create a run configuration: Run > Run Configuration > click the + button, and pick JSR45 Compatible Server, and then in the dialog that opens, select Remote, and set server host and port. Setting Application Server: Generic should work fine.
    3. Make sure you set the correct port in Startup/Configuration > Debug.

    4. Open the module settings (F3 on the project folder), and add a Web Facet under Facets, and under Web Resource Directories specify your JSP root folder.

    5. Click the Configuration... button, and select the folders with the beans, classes and libraries that your JSPs depend on.

    Now JSP breakpoints should work, provided that you started your server with the proper debug arguments.

    If you have a maven project with auto-import enabled then you might want to disable auto-import because every time the auto-import is triggered your library settings will be reset.

提交回复
热议问题