Question
Write JSP programs which can perform the following tasks: (i) A page requires input of four variables a, b, c and d, it then computes and displays the value a*b/(c+d). In addition, the program must make sure that, in case there is division by zero error, it is reported. Write the JSP code for the above. (ii) Why are cookies created? Explain their use with the help of two cookies namely customerID and customername. The example should demonstrate the use of the cookie.
Answer :
Word Count : 492
(i) To create a JSP page that takes inputs for four variables (a, b, c, and d), computes the result of a*b/(c+d), and handles division by zero errors, you can use the following code:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <html> <head> <title>Division Calculation</title> </head> <body> <h2>Enter Values for a, b, c, d</h2> <form action="" method="post"> a: <input type="text" name="a" required><br><br> b: <input type="text" name="b" required><br><br> c: <input type="text" name="c" required><br><br> d: <input type="text" name="d" required><br><br> <input type="submit" value="Calculate"> </form> <% String aStr = request.getParameter("a"); String bStr = request.getParameter("b"); String cStr = request.getParameter("c"); String dStr = request.getParameter("d"); ______ _____ _________ _______ __________ ________ ___.
_________ ________ ____ ___ __________ _________ _______.
___ ____ __________ _____ __________ _________ ______.
________ ___ _______ _______ ________ _____ ______ ____ _________ __________.
_________ _______ ______ ______ ____ ________ ______ _________ __________.
____ _________ _____ ______ ________ _____ _________ ____ ____.
_____ ________ _____ ____ __________ _______ _______.
_______ ___ ________ _______ ___ _________ __________.
_____ ____ _____ __________ ___ ____ _____ ________.
_____ _________ _______ _________ _________ _____.
___ ____ _______ ____ _______ _______ _________ ____ _____ _____ ___.
___ _______ ________ __________ _________ __________ ___ __________.
______ ___ ______ ____ _______ ________ ________ _______.
_________ ____ ____ ____ _________ _____ __________.
__________ ___ __________ ____ ________ _____ ____ __________ _____ _________.
____ ______ ______ _______ _________ ________ _______ ________ ___ __________ ________.
__________ ________ ________ _____ ___ ______ _____ ______.
_________ ____ ____ __________ ______ _______ ____ ________.
__________ _______ _________ ______ _________ _____ __________ _________.
__________ _______ ___ ______ ________.
______ ______ ________ ___ ___ _______ _______ __________ ___ ______ _______.
____ __________ _____ ____ _________ ____ ______ ______ __________ ________ _____ ____.
_____ ____ ________ __________ ____ _________ _________ __________ _______ __________ ___.
________ ______ _____ _____ ________ ___.
________ ___ _____ ___ _____ ________.
___ _____ _________ __________ _______ _______ ___ ____ ________ ________ __________.
__________ _______ __________ _________ ____ __________.
__________ _______ _____ ___ _______.
_____ _________ _____ _________ _____ ____ ______ _____ _______ ________ _______ _____.
_______ _______ _______ ______ ____ _______.
_____ ______ ____ _______ _________ _________ __________ _______ __________ ________ _____.
_____ ______ ____ ________ ______ ____ _______ _____ _________ ___ ________ _______.
_____ ____ ___ _________ ________ _______.
____ ___ __________ ____ ________.
______ _______ _________ ________ _______ ____ __________ ________ _______ ________ ______ __________.
______ _____ _______ ____ ___.
________ ______ __________ ______ ____ ________ ___ ____ __________.
__________ ______ ____ __________ ______ __________ ________.
___ _________ ___ ______ ___ ____ _______.
_____ _______ __________ __________ _______ _____ _____ _______ _______ __________.
___ _____ ___ _______ ____ __________ _____.
_____ ______ _______ ___ _______ ___.
___ ______ ______ _____ _______ _________ _____ ____ _______.
_______ ________ ___ _______ _________ ____ _____ ___.
__________ _______ _____ _______ _______.
______ ________ _____ __________ ____ _______ ___ _______ _____ _________.
__________ ___ ________ _________ __________ ___ ________ ____ _______ ________.
___ ________ _________ _____ _______ ________ _____ _________.
Get Full Answer on WhatsApp IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★