Thursday, April 23, 2009

Running a servlet using jsdk2.1

How to run a Servlet?

STEPS:

STEP 1: DOWNLOADING JSDK2.1
STEP 2: SETTING UP THE JSDK
STEP 3: CREATING A HTML FILE
STEP 4: CREATING A SERVLET CLASS
STEP 5: STARTING THE SERVER
STEP 6: BROWSER INTERPRETATION OF THE SERVER STARTED
STEP 7: VIEWING THE HTML FILE FROM THE BROWSER
STEP 8: STOPPING THE SERVER




STEP 1:DOWNLOADING JSDK2.1

Type this url in your browser to download the J2SDK(JAVA 2 SERVLET DEVELOPMENT KIT)

http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jsdk2_1-win.zip?BundledLineItemUUID=iCpIBe.m248AAAEgVllHfNHo&OrderID=9MFIBe.mvEQAAAEgRllHfNHo&ProductID=Mx3ACUFB4OIAAAEY1wI5AXis&FileName=/jsdk2_1-win.zip


STEP 2:SETTING UP THE JSDK

Extract the contents from the zip file
The folder name is jsdk2.1.
Copy this folder into the disk drive you want(I have used C: drive)

STEP 3:CREATING A HTML FILE

Type a html file (which invokes a servlet).
Store the html file in the directory(C:\jsdk2.1\examples\servlets)

Note:
Form tag in the html should look like
form action="http://localhost:8080/examples/servlet/yourservletclassname"


STEP 4:CREATING A SERVLET CLASS

Type the servlet class
Compile it
Copy the class file
Paste the class file in the directory(C:\jsdk2.1\examples\WEB-INF\servlets)


STEP 5:STARTING THE SERVER

Go to the directory C:\jsdk2.1

Double click startserver.bat
a command window will open (just minimize it)

STEP 6:BROWSER INTERPRETATION OF THE SERVER STARTED

Open ur browser
Type "http://localhost:8080" in the address bar and press Enter

You will see the Introduction page with Documentation and Examples link
(Success there is a server running on port 8080)

STEP 7: VIEWING THE HTML FILE FROM THE BROWSER

Type "http://localhost:8080/examples/servlets/yourfile.html"
Press Enter

the html contents will be displayed

The servlet wil be invoked according to your actions.

STEP 8: STOPPING THE SERVER

To stop ur server go to C:\jsdk2.1
double click stopserver.bat



Have a nice Servlet Programming Experience
Cheers :)

No comments:

Translate This Page

My Mom's blog

If u are a person interested in crafts and fabric stuffs pls check out this link.. http://www.fabriccraft.blogspot.com/

Blog Rankings

Personal Blogs - Blog Rankings