• Post Reply Bookmark Topic Watch Topic
  • New Topic

writing jsp codes  RSS feed

Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pls,am new to jsp and need help on how to start and where to writing jsp codes.i've install the apache tomcat server and don't no where to go from there.pls help!!.
Thanks for your help.
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello oghenekaro EFEKODO,

Writing a jsp code is very simple..
here i can just give u a sample JSP code that can able to print the name ur giving.. and i'll tell u the configuration also.. ok..

1) create a folder namee "test" go to any text editor..
2) write the code as given below..
<head> <title> test</title></head>
<form name="form1" method="post" action="test.jsp">
<input type ="text" size="20" name="name">
<input type="button" name="submit" value="submit">

3) save the file as index.jsp
4) open new file..
5) write the following code..
<head> <title> test </title></head>
String name = request.getParameter("name");
the String name means the variable to which we are saving the parameter comming from the previous page.. and getParameter("name") the name inside this will represent the value which ur taking from the text box.. u can see the name of the textbox and the argument is same
6) save the file as test.jsp
7) create a folder and name it as WEB-INF and create a new file there
8) write the code like this
<description>Test Program</description>
9) Save this file as web.xml inside WEB-INF
10)create another folder in the root directory called "META-INF" and create new file under that and do the following code there

Manifest-Version: 1.0
Created-By: 1.5.0_06 (Sun Microsystems Inc.)

11) Save the file as MANIFEST.MF
now the directory structure will be like this
-META-INF (folder)

then u have to create a war file.. war means web archive
for creating the war.. go to command prompt.
u give the path where u created the folder test
so now for egs ur in the path it will show like this

c:\test> jar -cvf test.war *.*
and press enter..

it will create a war file in the directory.. called test.war
now. for uploading the file to the Tomcat webserver.. u want the following this,..
check whether the webserver is working fine..
when u give this.. it will show the home page of tomcat.. the port which the tomcat listens default is 8080..
and u can see a link in the left hand side of the page..
Tomcat manager.. click that link.. there u want to give the username and password.. for loggin in to tomcat manager..

if it is successfully logged in.. the next step is uploading a war file..
u can see "deploy " down in the page.. u have to browse the war file from there and click the deploy..
then ur able to see the program in the list
or give like this

u can see the page u did..

check this out..

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!