As with other files, it's easy to run JSP files during the development cycle. If the JSP file has not been compiled, or if it has changed since it was last compiled, the IDE automatically compiles the file before running it. If the web server and web browser have not been started, the IDE automatically starts it. (If your default server is set to something other than the Tomcat server, this behavior might vary.)
To run a JSP file:
If there are no errors, you are switched to the running workspace and the output from the compiled JSP page is displayed in the web browser.
![]() |
You don't need to restart the server to pick up changes in the JSP or servlet file. However, you need to restart the server if there are changes you want to pick up in components referenced by the JSP (such as JavaBeans components or error pages). In those cases, simply right-click the JSP or servlet file and choose "Execute (Force Reload)" from the contextual menu. |
To run a servlet file:
init
parameters). Each of these logical servlets
can have more servlet mappings including mappings like /path_to_servlet/*
.
![]() |
If you create a new servlet from the New From Template wizard, the IDE writes some default values into the web.xml file and sets the URI property to match to this mapping.
But if the servlet is converted from any other class, the IDE does not specify the URI, and
asks you to specify the URI before the execution of the servlet.
The Tomcat server provides a servlet interceptor that enables you to
execute your servlet class without having it specified in a web.xml file. The servlet interceptor
provides a default mapping as follows: /servlet/your.package.YourServlet
|
See also | |
---|---|
Creating a JSP or Servlet File
Editing a JSP or Servlet File Compiling a JSP Source File |