How do I multiply 2 decimal values being passed from a html form to a JSP page for calculation?

Todd Boyer

This example illustrates passing a product price and  qty ordered.

<%@ page language="java" import="java.math.*" %>

BigDecimal subtotal = new BigDecimal(request.getParameter("productprice")).multiply(new BigDecimal(request.getParameter("qtyordered")));

<%= subtotal %>
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.