Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to Servlets

 
Nandini Sriram
Ranch Hand
Posts: 132
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
I am very new to Servlets. I went through some basics. I have some doubts in running servlets. I read that it needs Tomcat to run the servlets. I also saw the J2SDKEE 1.3.1 download on the Sun's site. Which one should I install to run Servlets/ JSPs?
Please guide me.
Thanks
Nandini
 
Amit KumarS
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ...
for running a servlet you first need to compile your servlet's .java file and for that you need J2SDKEE 1.3.1 'cause this J2SDKEE 1.3.1 has the jars like servlet.jar which helps in compiling your .java files and making .class files.. you need to install the J2SDKEE 1.3.1 and putt it into the class path..
now, once you are ready with the .class file of your servlet you need a web server like Tomcat, resin, weblogic etc... you can choose one among these and install into your machine...
now you need to put this class file into the class hierarchy..
let me give you an example... if you are using tomcat then you will have to make an application in your tomcat (if you already have one then ignore this)
1. You need to make a directory(suppose hello) in webapps folder by any name you want
2. make sorrocponding entry into server.xml which is in conf directory like below

3. now u need to create following directory structure in your "hello" directory
hello
|
|-(All JSP and HTML files here on in any subfolder you need)
|
|-WEB-INF
|
|-classes (all your servlet class files here)
|-web.xml (here all enteries of your servlet will go)
4. now you can run your tomcat and in browser you can type
http://<machine_name>:<port_no>/hello/<servlet_name>

hope things are clear to you now.. if still in doubt please revert back
Thnks
Amit
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nandini..
Other way you can download jwsdpJWSDP(Java Web Services Developer Pack)
With the bundle you can get Tomcat & Ant Tool too. Also download its DOCS.
Tomcat is a servlet container as explained by Amit.
Ant tool can be used to compile your servlet, build your servlet context.
You can have more info on ANT here
hth
MB
 
Nandini Sriram
Ranch Hand
Posts: 132
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Amit and Malhar.
I have installed the J2EE1.3 and Tomcat4.1. I am able to start the Tomcat server.
I have created a SomeServlet.java file. But it is not getting compiled. Should this .java file be in any specific directory?

I get "cannot resolve symbol" errors. I have set my classpath to "servlet.jar" inside Tomcat 4.1\common\lib.
Thanks in advance.
Nandini
[ November 01, 2003: Message edited by: Nandini Sriram ]
 
Nandini Sriram
Ranch Hand
Posts: 132
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I was able to run my first servlet.
Thanks
Nandini
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic