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.
greeting_jsp.jsp
<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 are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Create a greeting in jsp View All Comments
Post your Comment