This is sample jsp code that creates a sample Birthday Greeting in jsp. In the code given below we have used an image with some text message. To show image we have used a html tag <img src="" alt="">. Here 'alt' attribute is used to set the text message which is shown if image can not be shown for any reason.
<HTML> <HEAD> <TITLE>Creating a Greeting</TITLE> </HEAD>
<BODY bgcolor="#F8E0F7"> <H1><Font color="#088A08">B'Dy Greeting only 4 u.....</Font></H1> <img src="funny.gif" alt="Big Boat"> <br> <b>created by: </b> <% //Display the greeting out.println("www.roseindia.net"); %> </BODY> </HTML>
Save this code as a .jsp file named "greeting_jsp.jsp" in your application directory ('user' in our example) in tomcat and run this jsp page with url http://localhost:8080/user/greeting_jsp.jsp in address bar of the browser.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial