Showing posts with label Fahrenheit To Celsius Converter in JSTL. Show all posts
Showing posts with label Fahrenheit To Celsius Converter in JSTL. Show all posts

Sunday, May 29, 2016

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>