SIGN UP MEMBER LOGIN:    
ARTICLE

Performing Calculation in JSP

Posted by Vikas Mishra Articles | JSP January 11, 2012
In this article, I am going to describe an application of how to perform a calculation in JSP.
Reader Level:
Download Files:
 

In this article, I am going to describe an application through netbeans to perform a calculation in JSP. This article will help you to understand the concept of basic JSP.To develop this application we use the following steps.

Step 1 : Create a New Project.

In this step we select New Project option from file menu.

create new project.jpg


Step 2: Choose Project.

In this step we select web application from Java web option and then click on the next button.

select new web application.jpg

Step 3: Name and Location.

In this step we given it a specific name and set a specific location and click on the next button.

name and location.jpg
 

Step 4: Server and Setting.

We select a specific server for this application and click on the next button.

server and setting.jpg

Step 5 : Select Framework.

There is no need to select any framework for this application; just click on the finish button.

selectframework.jpg

Step 6 : Create JSP file.

We create one JSP file for this application.

create new jsp file.jpg

add.jsp

<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>
JSP calculation</title>
</head>
<body bgcolor="cyan">
<h1>Calculation through JSP is as </h1>
1 + 2 + 3<c:out value="${1 + 2 + 3}"/>
</body>
</html>

mul.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>
Multiplication Examples</title>
</head>
<body bgcolor="cyan">
<h3>Out Example</h3>
10 * 45 =
<c:out value="${10*45}" />
<br />
</body>
</html>


Step 7:
Compile and Run the application.

Now we compile the application and then run it on the server and find the following output.

Output

add.jsp

add.jsp.jpg

mul.jsp

mul.jsp.jpg

Resources related to this topic

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor