For all those who is trying to code JSP, they need JSP server. Up-to now Apache tomcat is the most stable and good server for JSP programs.
Software Needed
=>JDK (click here to download)
=>Apache Tomcat (Click here to download)
Installation
=>install JDK in your local drive(its default path is c:/programe files, you can change its location but it is recommended to use the default settings.)
=>Tomcat will be in .rar format. Extract the file in the suitable location(Make sure once you configure tomcat, you tomcat folder will be worked as primary location. so keep the files in the location where u can easily access and save your files. i am assuming that u have extracted you tomcat file on desktop)
Configuring Tomcat
I am using Windows 7, so the screen shoots and instruction will be based on Windows 7. however, other MS OS almost have the same mechanism.
=>Right Click on "My Computer"->Properties->Advanced setting->Environment variable.
=>Under user variables for username, click new.
=>A small window will open with title "New User Variable".
=>In "Variable name" type "JAVA_HOME"(make sure it is in capital) and in "Variable value" give the location of jdk folder.in my case Jdk folder is installed in default location (IE C:\Program Files\Java\jdk1.6.0_21). Best practice is to copy this location and paste it in the Variable value. And press OK.
=>Again click on New from User variable and in variable name type in "Path"(make sure P is capital only) and in variable value type in "%JAVA_HOME%\bin" and hit OK.
=>Hit Ok to exit from the environment variable window.
=>now start command prompt.(You can do it by typing cmd in run and shortcut key for eun in window + r).
=>Now enter in ur extracted apache tomcat folder from cmd.(as i extracted it on desktop, so i am showing you for desktop). it can be done by typing "cd Desktop/apache-tomcat-7.0.5"(your version may change).
=>Go in bin folder by typing "cd bin" in command prompt.
=> Now type startup.bat and press enter. Another window will open showing that the server has been started successfully.
=>Minimize the Command Prompt.(Do not close the command prompt or else the server will be stopped.)
=>Open Browser and type in "http://localhost:8080"(Theri is a colon between local host and 8080). if everthing works fine you will see the apache tomcat default screen.
=>And now you JSP code is ready to use. :)
Running JSP Code
Inorder to run JSP code i am showing you a simple programe to show you where to save how to save and how to run the jsp code.
=> Open Your Favorite editor.(i use Notepad ++) write a jsp code.
=>save file as <name>.jsp (.jsp is an extension for jsp programes), i named it sample.jsp. And save it in apache-tomcat/webapps/ROOT. (apache-tomcat is the same folder which we extracted at the very beginning).
=>After that go to browser and type "http://localhost:8080/sample.jsp"(Your file name could be different, no worries all u have to do is replace the sample with you file name.)
=> Yes you have succesfully isntalled and configured you apache tomcat server.
=> For any quries comment on this post.
Note: every time, to start the server you have to follow the command prompt procedure again. the rest is fine.
Have a nice day :)