Saturday, October 2, 2010

JSP-Requirements for running JSP


REQUIREMENTS FOR RUNNING THE JSP

TOMCAT APPLICATION SERVER



There are many version of the tomcat server.

You can download tomcat server from the following apache official site.

www.tomcat.apache.org


If you have tomcat 4 or older version, you must set path in environmental variables.

How to set the Environmental variable if you use tomcat 4.

Step 1:

            Goto desktop




















Step 2:
               Right click on the My Computer





















In system properties window, you select Advanced in Tabbed panel.



















In system properties window, you select Advanced in Tabbed panel.























After select Advanced, you click Environment Variables
Environmental window will open.



















There are two parts here.

1). User variables

2). System variables

You only use user variables

1). CATALINA_HOME

Select New Button. New User Variable window will open. Where you give variable name as CATALINA_HOME and Variable value as F:\Apache. Because I have installed Apache tomcat server in F:\Apache. And click OK.



















2). JAVA_HOME
 
            You follow above steps to create another user variable for JAVA_HOME

Variable name     JAVA_HOME

Variable Value    (where you have installed java) F:\jdk1.5




















3). PATH
            Create another user variables for PATH

            Variable name                         PATH

            Variable value             F:\jdk1.5\bin; (note put the semicolon)






















4). CLASSPATH

            Create another user variable for CLASSPATH

            Variable name                    CLASSPATH

             Variable value      F:\jdk1.5\lib; F:\Apache\lib\ jsp-api.jar; F:\Apache\lib\servlet-api.jar;

























Note: if you use Tomcat 4 or older version.
  
If you use latest version such as tomcat 5 or tomcat 6. No need to create environment variables

We want to check the server is run properly or not.

Goto F:\Apache\bin\

Select startup















Open the browser

Enter http://localhost:8080 in address bar













How To create Folder For Running jsp


Where to create folder to save jsp file and html file.

Go to Apache Tomcat Folder( where you have installed tomcat)

For Example I have installed           F:\Apache

Open Apache Tomcat Folder.














Open webapps folder













Create New Folder and named something such as suresh as your desire.
















Open Folder suresh.

You create WEB-INF Folder

You create jsp Folder for storing jsp

You create html Folder for storing html














Next you have to create web.xml.

Go to back webapps











Open the Folder examples and WEB-INF
























Copy the web.xml file and paste into F:\Apache\webapps\suresh\WEB-INF
















go back jsp folder

F:\Apache\webapps\suresh\jsp

Create jsp file

Open the notepad

Type the following coding

< html >
< head > < title > jsp example < /title > < /head >
< body >
hai welcome
< %= welcome to jsp wolrd % >
< /body >
< /html >

Start the tomcat server


















Open the browser such as windows Internet Explorer or FireFox

                http://localhost:8080/suresh/jsp/welcome.jsp

                You will get output

                Hai welcome

                Welcome to jsp world.


No comments:

Post a Comment