Sunday, May 29, 2016

Factorial Solver in JSTL and JSP

A simple program that I wrote that we ask the user to give a number and then the program will compute the factorial value of the number using JSP and JSTL. The code is very simple and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title> Factorial Solver  Solver in JSTL and JSP</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold; 
size:12px;
color:blue;
}
</style>
<body>
  <h2> Factorial Solver in JSTL and JSP </h2>
  <br>
  <form method="post">
      Enter a number &nbsp; &nbsp;
    <input type="text" name="number"  size="3" value="<c:out value="${param.number}"/>" autofocus/><br>
      <br> <br>
     <input type="submit" value="Compute Factorial"  title="Click here to findout the factorial value." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">

         <%!
    int numberfactorial(int number)
    {
        if (number == 1) {
            return number;
        }
        else {
            return number * numberfactorial(number - 1);
        }
    }
    %>
<%int no = Integer.parseInt(request.getParameter("number"));%>
    <%
        out.println("The factorial  of " + no + " is " + numberfactorial(no)+ ".");
    %>
  

</c:if>
</body>
</html>

Area of the Circle Solver in JSTL

A simple program that I wrote using JSTL of Java Server Pages Standard Tag Library that will ask the user to give the radius of the circle and then our program will compute the area of the circle.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360




Sample Program Output

Program Listing

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title> Area of the Circle Solver in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold; 
size:12px;
color:blue;
}
</style>
<body>
  <h2> Area of the Circle Solver in JSTL</h2>
  <br>
  <form method="post">
      Enter the Radius &nbsp; &nbsp;
    <input type="text" name="radius"  size="3" value="<c:out value="${param.radius}"/>" autofocus/><br>
      <br> <br>
     <input type="submit" value="Compute Area"  title="Click here to findout the area of the circle." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
 <c:set var="convert" scope="session" 
 value="${ (param.radius* param.radius) * 3.1416}"/>
 <br>

The area of the circle is <fmt:formatNumber value="${convert}" maxFractionDigits="2"/>.
</c:if>
</body>
</html>

Celsius To Fahrenheit Converter in JSTL

A simple program that I wrote using JSTL or Java Server Pages Standard Tag Library that will ask the user to give a temperature in Celsius and then it will convert in Fahrenheit temperature. The code is very simple and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing

celsius.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title> Celsius To Fahrenheit Converter in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold; 
size:12px;
color:blue;
}
</style>
<body>
  <h2> Celsius To Fahrenheit Converter in JSTL</h2>
  <br>
  <form method="post">
     Give temperature in Celsius &nbsp; &nbsp;
    <input type="text" name="cel"  size="3" value="<c:out value="${param.cel}"/>" autofocus/><br>
      <br> <br>
     <input type="submit" value="Find Celsius"  title="Click here to findout the temperature in fahrenheit." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
 <c:set var="convert" scope="session" 
 value="${ (9/5) * param.cel  + 32}"/>
 <br>

The Temperatue in Fahrenheit is <fmt:formatNumber value="${convert}" maxFractionDigits="2"/> &degF.
</c:if>
</body>
</html>

Fahrenheit To Celsius Converter in JSTL

A simple program that I wrote using JSTL or Java Server Pages Standard Tag Library that will ask the user to give a temperature in Fahrenheit and then it will convert in Celsius temperature. The code is very simple and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>Fahrenheit To Celsius Converter in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold; 
size:12px;
color:blue;
}
</style>
<body>
  <h2> Fahrenheit To Celsius Converter in JSTL</h2>
  <br>
  <form method="post">
     Give temperature in Fahrenheit &nbsp; &nbsp;
    <input type="text" name="fah"  size="3" value="<c:out value="${param.fah}"/>" autofocus/><br>
      <br> <br>
     <input type="submit" value="Find Celsius"  title="Click here to findout the temperature in celsius." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
 <c:set var="convert" scope="session" 
 value="${ ((param.fah - 32) * 5)/9}"/>
 <br>

The Temperatue in Celsius is <fmt:formatNumber value="${convert}" maxFractionDigits="2"/>.
</c:if>
</body>
</html>



Average Grade Solver in JSTL

A simple program that I wrote using JSTL or Java Server Pages Standard Tag Library that will ask the user to give the grades in different subjects and then our program will compute the average of the five grades and determine whether the student pass or failed in their overall grades. The code is very simple and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360




Sample Program Output


Program Listing

grade.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>Average Grade Solver in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold;
size:12px;
color:blue;
}
</style>
<body>
  <h2> Average Grade Solver in JSTL</h2>
  <br>
  <form method="post">
     Enter Grade in Math &nbsp; &nbsp;
    <input type="text" name="one"  size="3" value="<c:out value="${param.one}"/>" autofocus/><br>
    Enter Grade in Science &nbsp; &nbsp;
    <input type="text" name="two"  size="3" value="<c:out value="${param.two}"/>"/> <br>
     Enter Grade in Physical Education &nbsp; &nbsp;
    <input type="text" name="three"  size="3" value="<c:out value="${param.three}"/>"/><br>
     Enter Grade in History &nbsp; &nbsp;
    <input type="text" name="four"  size="3" value="<c:out value="${param.four}"/>"/><br>
     Enter Grade in English &nbsp; &nbsp;
    <input type="text" name="five"  size="3" value="<c:out value="${param.five}"/>"/>
   <br> <br>
     <input type="submit" value="Find Average"  title="Click here to findout the average grade." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
 <c:set var="average" scope="session" 
 value="${ (param.one + param.two + param.three + param.four + param.five) /5}"/>
 <br>
Your average grade is <fmt:formatNumber value="${average}" maxFractionDigits="0"/>.
</c:if>
<c:choose>
  <c:when test="${average >= 75}">
    <br> <font color="green">
    <h3>You have a Passing Average Grade.</h3> </font>
  </c:when>
    <c:otherwise>
    <font color="red">
  <h3>You have a Failing Average Grade.</h3> </font>
  </c:otherwise>
</c:choose>
</body>
</html>




Average of Three Numbers in JSTL

A simple program that I wrote using JSTL or Java Server Pages Standard Tag Library that will ask the user to give the number three numbers and then our program will compute the average of the three numbers. The code is very simple and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360





Sample Program Output


Program Listing

average_numbers.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
<title>Average of Three Numbers in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold;
size:12px;
color:blue;
}
</style>
<body>
  <h2> Average of Three Numbers in JSTL</h2>
  <br>
  <form method="post">
     Enter Fist Number &nbsp; &nbsp;
    <input type="text" name="one"  size="3" value="<c:out value="${param.one}"/>" autofocus/><br>
    Enter Second Number &nbsp; &nbsp;
    <input type="text" name="two"  size="3" value="<c:out value="${param.two}"/>"/> <br>
     Enter Third Number &nbsp; &nbsp;
    <input type="text" name="three"  size="3" value="<c:out value="${param.three}"/>"/>
   <br> <br>
     <input type="submit" value="Find Average"  title="Click here to findout the average of the three numbers." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
 <c:set var="average" scope="session" 
 value="${ (param.one + param.two + param.three) /3}"/>
 <br>

The average of <c:out value="${param.one}"/>,
 <c:out value="${param.two}"/> and <c:out value="${param.three}"/>
 is <fmt:formatNumber value="${average}" maxFractionDigits="2"/>.
</c:if>
</body>
</html>

Simple Payroll Program in JSTL

A simple program that I wrote using JSTL or Java Server Pages Standard Tag Library that will ask the user to give the number of days work of the employee and then it will ask the rate per day and then our program will compute the salary of the employee. The code is very simple and easy to understand.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing

payroll.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Simple Payroll Program in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold;
size:12px;
color:blue;
}
</style>
<body>
  <h2> Simple Payroll Program in JSTL</h2>
  <br>
  <form method="post">
     Enter Number of Days Work &nbsp; &nbsp;
    <input type="text" name="days"  size="3" value="<c:out value="${param.days}"/>" autofocus/><br>
    Enter Rate Per Day&nbsp; &nbsp;
    <input type="text" name="rate"  size="3" value="<c:out value="${param.rate}"/>"/>
   <br> <br>
     <input type="submit" value="Compute Salary"
     title="Click here to findout the salary of the employee." />
     <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
 <c:set var="salary" scope="session" value="${param.days * param.rate}"/>
 <br>
Your salary is $<c:out value="${salary}"/>.
</c:if>
</body>
</html>



Positive and Negative Number Checker in JSTL

A simple program that I wrote that will check if the given number is an positive or negative number using JSTL or JSP Standard Tag Library. The code is very easy to understand and learn from it.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360




Sample Program Output


Program Listing


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Positive and Negative Number Checker in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold;
size:12px;
color:blue;
}
</style>
<body>
  <h2> Positive and Negative Number Checker in JSTL</h2>
  <br>
  <form method="post">Enter a Number &nbsp; &nbsp;

    <input type="text" name="number" />
   <br> <br>
     <input type="submit" value="Check Number"
     title="Click here to find if the given number is Positive or Negative" />

    <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">
      <c:if test="${param.number >= 0}"> 
       <br /> <br /><br>
      The given number is POSITIVE.
     
      </c:if>
      <br /> <br /><br>
      <c:if test="${param.number < 0}"> The given number is NEGATIVE.
     
      </c:if>
    </c:if>
  
</body>
</html>

Odd and Even Number Checker in JSTL

A simple program that I wrote that will check if the given number is an odd or even number using JSTL or JSP Standard Tag Library. The code is very easy to understand and learn from it.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360







Sample Program Output


Program Listing

index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Odd and Even Number in JSTL</title>
</head>
<style>
body 
{
font-family:arial;
font-weight:bold;
size:12px;
color:blue;
}
</style>
<body>
  <h2> Odd and Even Number Checker in JSTL</h2>
  <br>
  <form method="post">Enter a Number &nbsp; &nbsp;

    <input type="text" name="number" />
   <br> <br>
     <input type="submit" value="Check Number"
     title="Click here to find if the given number is an ODD or EVEN" />

    <br />
    </form>
<c:if test="${pageContext.request.method=='POST'}">

      <c:if test="${param.number % 2 == 0}"> 
       <br /> <br /><br>
      You give an EVEN number.
     
      </c:if>
      <br /> <br /><br>
      <c:if test="${param.number % 2 != 0}"> You give an ODD number.
     
      </c:if>
    </c:if>
  
</body>
</html>


Addition of Three Numbers Using JSTL

A simple program that I wrote that will add the sum of the three numbers using JSTL or JSP Standard Tag Library. The code is very easy to understand and learn from it.

 Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360



Sample Program Output


Program Listing

index.jsp


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
body 
{
font-family:arial;
font-weight:bold;
size:12px;
color:blue;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Addition of Three Numbers in JSTL</title>
</head>
<body>
<h3> Addition of Three Numbers in JSTL</h3>
The sum of 10, 20 and 30 is  <c:out value="${10 + 20+ 30}" />.
</body>
</html>