To work with a J2EE application, you need two things in your system.
1. jdk
2. Apache Tomcat
Since both of them are open source you can download it from the Net. You can try the links below:
http://java.com/en/download/
http://tomcat.apache.org/download-60.cgi
After installing jdk 1.5 or latest version, you can also install Apache Tomcat of versions 5.0 or 6.0.
During installation of Tomcat, the default port number is configured as 8080. You can also change port number if the default port number is already allocated and conflict occurs.
To change the port number after installation, go to the default path where tomcat has been installed. In general, it resides in C:\Program Files\Apache Software Foundation\Tomcat 6.0.
Inside Tomcat, you can view the server.xml file; locate the following segment.
<!– Define a non-SSL HTTP/1.1 Connector on port 8080 –>
<Connector port=”8080″ … />
Here you can change the port number to 8081 or 8082 or any appropriate port numbers.
After installation of Tomcat, you can Start Apache Tomcat from the Start->Programs Menu.
To check whether Tomcat is running perfect, you can use any browser and give the following address in the address bar.
http://localhost:8080/
If it is running perfect, a Tomcat Home Page will be shown, otherwise it will display an error page.
Now we can create a simple application in J2EE. Here we are going to design a simple HTML page where a user can input 3 fields like Name, Age and Place. When the user clicks the submit button on the HTML Page, it will be navigated to a JSP Page where those details are shown.
The steps are as follows:
1. Create a HTML file with extension .html either in notepad or any other editor with the following code. [Here I use Form.html]
<html> <body> <form action="MyFirst.jsp" method="post"> <table> <tr> < td >Name</td> < td ><input type="text" name="name" /></td> </tr> <tr> <td > Age</td> <td ><input type="text" name="age" /></td> </tr> <tr> < td >Place:</td> < td ><input type="text" name="place" /></td> </tr> <tr> < td ><input type="submit" value="submit"></td> < td ><input type="reset" value="reset"></td> </tr> </table> </form> </body> </html>
2. Create a JSP(Java Server Page) with name “MyFirst” and extension .jsp in notepad or any other editor with the following code.
<%@ page language="java"%> <html> <body> <% String getname=request.getParameter("name"); String getage=request.getParameter("age"); String getplace=request.getParameter("place"); out.println("Name:"+getname); out.println("Age:"+getage); out.println("Place:"+getplace); %> </body> </html>
3. Go to the location where the Tomcat has been installed. You can see a webapps folder. Create a new folder(Here I used Test) inside that and
copy these 2 files in to that.
4. Take any browser ie., IE or Mozilla and type in address bar as http://localhost:8080/Test/Form.html
5. Insert the fields and when you click the submit button, the values will be displayed on the JSP Page.
Points to Remember:
1. Normal JSP code is enclosed with in tags which are known as scriplets.
2. request.getParameter() is a method to get values from the HTML page using the name attribute in HTML page.
3. out.println is used to display data in a JSP page.




