11.6. Creating a Servlet in Place
Problem
You want to develop web applications in place, without having to copy files over from the Eclipse directories.
Solution
Set the project’s output folder to the web container’s proper target directories.
Discussion
As an example, we’ll create a new project
here,
ServletInPlace
, and store the needed Tomcat
files in Tomcat directories. Create this project by bringing up the
New Project folder and entering the name
ServletInPlace
. To specify that we want the
compiled output to go into the Tomcat directories rather than be
stored locally, click Next, and click the Browse button next to the
Default output folder box to open the Folder Selection dialog.
Next, click the Create new folder button; then click the Advanced
button in the New Folder dialog. To connect to the Tomcat directory
we want to use, check the “Link to folder in the
file system” checkbox and click the Browse button.
Browse to the target directory for our compiled code,
jakarta-tomcat-5.0.19\webapps\Ch11\WEB-INF\classes
,
and click OK, bringing up the New Folder dialog again. In that
folder, give this new folder the name output
, as
shown in Figure 11-5, and click OK.
Figure 11-5. Setting up a new output folder
When we build this project, all compiled output will be stored where
we want it, in the classes
folder (actually, in this case, in the
classes\org\cookbook\ch11
folder, following the ...
Get Eclipse Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.