• Post Reply Bookmark Topic Watch Topic
  • New Topic

What do I need to run servlets?

 
Rekha Anand
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all...

I am preparing to dive in the pool of Servlets and JSPs. What (software/application) is it that I need to have on my personal computer to start coding and testing servlets..?

Regards,

Rekha Anand
[ May 12, 2008: Message edited by: Bear Bibeault ]
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would need to have a J2EE web server like Tom cat. Once you have a specific server you can search for some tutorials and write your HelloWorld Servlet
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit M Tank:
You would need to have a J2EE web server like Tom cat. Once you have a specific server you can search for some tutorials and write your HelloWorld Servlet


Actually Tomcat is not a J2EE server -- which is taken to mean one capable of EJB. BUT... Tomcat, as a web server and servlet container, is a perfect choice for JSP and Servlets.
 
Rekha Anand
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!!

Do I write servlet code in jdk just as regular java code?

Rekha
 
Praveen Kumar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rekha Anand,

Writing servlet and deploying pretty easy.

Write basic servlet and configure in web.xml and start your container.

For more info google " Writing servlet".
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually Tomcat is not a J2EE server -- which is taken to mean one capable of EJB. BUT... Tomcat, as a web server and servlet container, is a perfect choice for JSP and Servlets.


What I meant by J2EE Web server is a "Servlet Container" or JSP Engine. I did not mean a J2EE App server(EJB container). Sorry for confusion.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rekha Anand:

I am preparing to dive in the pool of Servlets and JSPs. What (software/application) is it that I need to have on my personal computer to start coding and testing servlets..?


I would recommend you install either eclipse or netbeans and the bundled JDK. I use netbeans.

You can have it write the basics for you, netbeans includes tomcat for testing and debugging.

Just have it write a .jsp page for you.
 
Rekha Anand
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I downloaded JSWDK from Sun website. It comes along with a web application server. I was able to deploy a sample web application that came with the download.

Now, I have written my first servlet FirstServ.java
In order to deploy it, I need to create a war file. I know how to create a war file, but there must also be a web.xml file associated with the application. I read that web.xml should reside in web-inf directory but I did not find such a directory. Do I have to create it? Where?
Could you please help me step by step...?

Regards
Rekha
[ May 13, 2008: Message edited by: Rekha Anand ]
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's why I suggested using NetBeans, which Sun offers free, open source, etc.

It will make the WAR file automatically for you.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course, allowing an IDE to do everything for you also prevents you from learning how to do it.

What I'd suggest doing is grabbing a copy of the Servlet Spec and read it cover to cover. It's actually a surprisingly easy read, and you'll learn how web applications work.
 
Rekha Anand
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I read the servlet specs. But it did not have the solution to my problem. I would like to create the war file step by step. Please help.

Regards
Rekha
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Servlet Spec goes into great detail regarding the layout of a web app. A war file is simply a zipped version of that. Once you've got the web app laid out in the file system, you can use the jar command to zip it up, or use the Ant war task to easily create war files.
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
Of course, allowing an IDE to do everything for you also prevents you from learning how to do it.


Yes, I generally worry about learning after the basic stuff is working.
Different flavors for different folks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!