In this article I would like to share with you a simple greeter program that I wrote using Java Server Pagers or JSP scripting language that is based in Java programming language. What does the program will do is very simple it will ask the user its first and last name and then say hello to the user.
I just wrote this code as a learning aid in my study of JSP in J2EE programming for web in Java. I hope beginners like me will benefited from my work.
If you have some questions please send me an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com.
People here in the Philippines can reach me at my mobile number 09173084360.
Thank you very much and Happy Programming.
People here in the Philippines can reach me at my mobile number 09173084360.
Thank you very much and Happy Programming.
Program Listing
<html>
<head>
<title>Greeter in JSP</title>
</head>
<body>
<form action="test.jsp">
<table border="1">
<tr>
<td>Enter First Name</td>
<td><input type="text" name="first_name" id="first_name" value=""></td>
<td>Enter Last Name</td>
<td><input type="text" name="last_name" id="last_name" value=""></td>
<td><input type="Submit" value="Click to Submit"></td>
</tr>
</table>
</form>
<br>
<%
String first_name = request.getParameter("first_name");
String last_name = request.getParameter("last_name");
if (first_name == null || last_name == null) {
} else {
if (first_name.length() == 0 || last_name.length() ==0) {
%>
<b>myText is empty</b>
<% } else { %>
<b>Hello <%= first_name %> <%= last_name %></b>
<%
}
}
%>
</body>
</html>