Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Quickguide Tomcat Create Web Page with jsp

Related Tutorials


 
 

Share on Google+Share on Google+

Create Web Page with jsp

Advertisement
In this example we will show you how to create first web page on tomcat server. JSP simply application that work with Java inside HTML pages.

Web Page with jsp

     

In this example we will show you how to create first web page on tomcat server. JSP simply application that work with Java inside HTML pages. Now we can take any existing HTML page and we change its extension to "Date.jsp" instead of "Date.html". This one the simply exercise for your first application JSP. The HTML file we used in the previous exercise. After modify file extension from ".html" to ".jsp". Then the application load the new file, with the "date.jsp" extension, in your browser. 


Following example of date will really help you understand a jsp page. 

In this example we are going to display a current date and time on client browser. For this we will create a simple dynamic JSP page with java.util.Date class (<%= new java.util.Date() %>). The java.util.Date class is used to get the current date/time for display on JSP page. 
Start the tomcat server, open a browser window and type the URL : Start the tomcat server, open a browser window and type the URL http://localhost:8080/date.jsp

The code of the program is given below:

<%@page contentType="text/html" import="java.util.*" %> 
<html>
<body>
<p>&nbsp;</p>
<div align="">
<table border="0" cellpadding="0" cellspacing
="0" width="460" bgcolor="#999999">
<tr>
<td width="100%"><font size="6" color
="#800000">&nbsp;Date Example</font></td>
</tr>
<tr>
<td width="100%"><b>&nbsp;Current Date 
and time is:&nbsp; <font color="#0000ff"> 
<%= new java.util.Date() %>
</font></b></td>
</tr>
</table>
</center>
</div>
</body>
</html>

The output of the program is given below:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 8, 2008

Related Tutorials

Discuss: Create Web Page with jsp  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
sandhya
June 28, 2011
hw to divide webpage into some divisions...

m creating a website,n started creating home page in jsp.hw to divide the home page into some divisions(rows,columns).i know hw to do it using frames in html bt in jsp?????help me by giving some example code with explanation n use of tags plz....so that i can understand perfectly.....my frnd told it can b done using <div> bt m nt able to understand that hw to do.....
DMCA.com