Sunday, May 29, 2016

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>

No comments:

Post a Comment