Thursday, 31 January 2013

How to make a JSP page?



JSP: JSP stands for java server pages.
it is based on java platform which is the platform independent language. it is server side language. Basically the a jsp page is the combination of the html coding and some java codes , that are written in specific tags. When we are making a jsp page we have to save this file with the extension .jsp not in .html . Here is a simple coding to implement a jsp page. But remember that we have to execute these pages on the web server such as Tomcat etc.
<html><head><title>Simple page using jsp</title></head>
<body><center><h1>This is my first page using the Jsp</h1>
My name is:<% out.println("YourName"); MyAge is:out.println("MyAge"); %>
<%! int i=1;int s=0;%>The sum of first 7 number is:
<% for(i=1;i<=7;i++){s=s+i}%>
<%=s%>
</center></body></html>
save this file with .jsp and put it in the application folder of the web server.
and then type in browser url: localhost:8080/filename.jsp
the 8080 port is default for tomcat server. the different tags are used in this file which will discussed earlier.if u have any question then comment,please..

No comments:

Post a Comment