Running a Servlet

See Also

When you run a servlet, the IDE sends a URL to the server. The URL is comprised of the server's URL, the Execution URI value, and Request Parameters. The default URI value is specified in the deployment descriptor (the web.xml file).

tip

Your servlet must have an entry defined in the deployment descriptor (the web.xml file) in order to be able to run. The entry can be created automatically by the IDE when you create a servlet in the New File wizard. Otherwise, you have to create it by hand in the web.xml file.

To run a servlet:

  1. (Optional) Define request parameters to pass to the servlet.
  2. Select the servlet in the Source Editor or Projects window.
  3. Choose Run > Run File > Run "filename.java" (Shift-F6) from the main menu. If the compiled servlet is newer, the server reloads the servlet.
tip

If you are using a , this command is disabled by default. You have to write an Ant target for running the currently selected file in the IDE and hook it up to the Run Class command. For a full guide to configuring free-form projects, see:

Troubleshooting

If you get "file not found" errors when you execute a servlet, see Accessing Local files Through a Proxy for possible solutions.

See Also
About Deploying Web Applications
Deploying a Web Application
Running a JSP File

Legal Notices