Newbie: Tomcat and IDEA
I'm completely new to server-side development, so excuse my (maybe)
simple question:
I want to start with Servlets and JSP on Tomcat 4.0. How should I
configure IDEA to getting this done easily? Thanks in advance!
Cheers,
Tom
Please sign in to leave a comment.
I've tried the Webapps-tutorial by IntelliJ, but I'm unsure, what to
enter as application context path.
My first start with JSP and Tomcat 4.1 answered IDEA 3.0.1 with
endless internal errors.
I would highly appreciate a more detailed tutorial, so even web
application newbies can start with it in IDEA.
Tom
Thomas Singer <idea@regnis.de> schrieb:
>I'm completely new to server-side development, so excuse my (maybe)
>simple question:
>
>I want to start with Servlets and JSP on Tomcat 4.0. How should I
>configure IDEA to getting this done easily? Thanks in advance!
>
>Cheers,
>Tom
First of all: don't use Tomcat 4.1.x, it's not supported by IDEA (it's Tomcat's fault, not IDEA's). Use Tomcat 4.0.6 instead.
Second: I'll send you a very small sample project which you can use as a start.
Thanks, Martin.
Tom
Martin Fuhrer <mf@fuhrer.com> schrieb:
>First of all: don't use Tomcat 4.1.x, it's not supported by IDEA (it's Tomcat's fault, not IDEA's). Use Tomcat 4.0.6 instead.
>Second: I'll send you a very small sample project which you can use as a start.
And here it ist. The zip file contains the complete project directory. You will have to adjust several path settings to match your environment.
If you want to start a project from scratch these are the steps I did to create the sample project:
1.)
Create this directory structure:
<project-dir>/app
<project-dir>/bin
<project-dir>/cfg
<project-dir>/src
2.)
Create an IDEA project with <project-dir>/bin as compiler output path and
<project-dir>/src as source path.
3.)
Add <tomcat-dir>/common/lib/servlet.jar to the classpath.
4.)
Copy <tomcat-dir>/conf/web.xml to <project-dir>/cfg.
5.)
Create <project-dir>/cfg/server.xml containing a minimal server configuration.
6.)
Create <project-dir>/app/WEB-INF/web.xml containing all servlet parameters.
7.)
Create <servlet-class>.java in <project-dir>/src.
8.)
Create a web application:
- open project properties dialog
- choose Web tab
- select 'Enable Web application support'
- choose 'Add...'
- enter an arbitrary name for the web application
- enter <project-dir>/app as document root
- select 'Validate JSP pages on make
9.)
Create a run configuration:
- open the run dialog
- choose WebApp tab
- add a new configuration
- 'Web application' should contain the name you entered in 8.)
- 'Application server' should contain 'Tomcat 4.0.x Server'
- 'Debuggee host' should contain 'localhost'
- 'Debuggee port' should contain '5050'
- select 'Launch server before debugger attaches'
- enter <tomcat-dir> in 'Catalina home'
- enter <project-dir>/cfg in 'Path to Catalina configs'
- choose the context path in 'Application context path'
(this is the context path you configured in <project-dir>/cfg/server.xml)
- select 'Include project classpath'
10.)
Execute the run configuration.
11.)
Open a browser and request the servlet. The URL of the example project is:
http://localhost:8080/j2ee/hello
The elements of the URL are:
http: pretty obvious...
localhost: host name entered in <project-dir>/cfg/server.xml
8080: port number entered in <project-dir>/cfg/server.xml
j2ee: context path entered in <project-dir>/cfg/server.xml
hello: URL pattern entered in <project-dir>/app/WEB-INF/web.xml
12.)
Create a JSP page in <project-dir>/app.
13.)
Restart the server.
14.)
Request the JSP page with http://localhost:8080/j2ee/hello.jsp.
Attachment(s):
j2ee.zip
You may find this overview helpful in determining dependencies between configuration settings.
Attachment(s):
j2ee.gif
Thank you again. This was the best tutorial I could get -- works like a charme.
Cheers,
Tom
Hi
Thanks a lot for this example. It was just what I needed to get things up and running. It is one of the best samples I have come across. It is small, well documented and it gives the novice exactly what he needs.
It is a truly Keep It Simple and Stupid (KISS)
Thanks again.
You're very welcome.
By the way there are three modifications necessary in order to use Tomcat 5:
1.) The servlet library has been renamed from servlet.jar to servlet-api.jar.
2.) There are some changes in the server.xml file.
3.) You guessed it: you have to select 'Tomcat 5.0 Server' in the WebApp configuration...
Attachment(s):
j2ee-tomcat5.zip
Me again.
I have been happy user since your posting. But I just upgraded and found that they added something called webmodules. Can you please write a post on this to?
Yes, I can write a post on the web module thing:
Forget about the newest builds for now if you want to do web development. Stuck with build 977 and be happy.
I wasn't able to set up a project using web modules yet, and I don't know of anybody who was. After several attempts to create a web module and tons of exceptions and strange error messages I surrendered and switched back to build 977.
As soon as I get something working I will post it here.
Does IntelliJ support debugging JSPs with Tomcat 5.0.16? Thanks
James Treacy wrote:
Yes. it's complex right now because of all the changes in web apps.
See mini how to posted this AM in this forum. It will require A LOT of
patience.
R
Ok, things are improving. I've put together a small sample project which uses a servlet, a JSP, and a custom taglib. It works with build #1050 and tomcat 5.
Attachment(s):
j2ee-1050.zip
Martin Fuhrer wrote:
WOHOO! :)
R
Hey, look at the thread title. It was meant for newbies, not for you! :)
By the way: Thanks for your pioneering work! It helped me a lot.
The same sample project again, working with tomcat 5 and build 1074.
Attachment(s):
j2ee-1074.zip
I'm using your simple program to verify if the Tomcat / IntelliJ installation is OK. I tried to download your latest 1074 zip. But it not possible to open it after downloading. Can you please opload a new one.
Now that Tomcat 5 and IntelliJ 4 is released I find it strange that there is no information on how to set it up in IntelliJ documentation.
Please try again. I just downloaded it myself and can open it without any problem. If the problem remains I can send you the file by mail.