Home > Contents > Index >
calculator:go
Calculates the value of an expression.
Syntax
<calculator:go value="postfixstring
" varname="result
"/>Parameters
value
(required)- Input parameter. Postfix expression as a string with the following format:
"opreand1 operand2 ... operandn opchar"- where
operand1
,operand2
, ...,operandn
are one or more operands, andopchar
is one of the following operator characters or strings:
+
-
*
/
%
=
!=
LT
GT
LTE
GTE
AND
OR
NOT
All values are separated by spaces, and the entire value
input string is contained within double quotes.
varname
(required)Input and output parameter. As input, name of a string that holds the output that results from evaluating the expression.
Description
The value is computed using reverse polish notation. Numbers in the expression string are pushed onto a stack. Operations pop numbers off the stack as needed and push the result. The final answer is the top element of the stack.
Each JSP file containing this tag must have the following directive at the top:
<%@ taglib prefix="calculator" uri="futuretense_cs/calculator.tld" %>
Example
<!-- Divide total price by item quantity to get the item price. --> <calculator:go value="100 20 /" varname="calcout"/> <!-- Convert the above item price to currency. --> <currency:create name="currencyxml"/> <currency:getcurrency name="currencyxml" value="10.08"
varname="gotcurrencyxml"/>
Home > Contents > Index > ![]()
Oracle JSP Tag Reference
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.