Simple tax Calcularot help
Hi All. Very New to the JSTL devlopment tool. I really need help in this simple tax calculator program. Basically, it prompts the user to enter his income. And at the click of the calculate text button, the tax amount pops up at the Your text amount part. I can't seem to get the tax amount to pop up. I have managed to get my form validation to work though. Any help will be greatly appreciated.
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
<head><title>Question 4</title>
<script type="text/javascript">
function verify() {
regExp = /\d+\b/;
if (!(regExp.test(thisForm.income.value))) {
alert("You must enter valid income amount!");
return false;}
return true;
}
</script>
</head>
<body>
<fmt:setLocale value="en-US" />
<c:set var="amount" value="${param.income}" scope = "application"/>
<c:if test='${empty param.income}'>
<c:set var="amount" value="0"/>
</c:if>
<fmt:setLocale value="en-US" />
<c:set var="tax" value="${param.tax}" scope = "application" />
<b>Enter the amount of total income for this year:</b>
<form name="thisForm" action="Question4.jsp" method="post"
onsubmit="return verify();">
Amount of sales:<input name=income size=10 value=""> <br/><br/>
<input type=submit value="Calculate Tax">
</form>
// I believe there are errors here. Can't seem to find out where.
<%-- the following code is to calculate the tax --%>
<c:choose>
<c:when test =" ${param.income} > '1' && ${param.income} < '3000'}"
> double tax = '0'
</c:when>
<c:when test=" ${param.income} > '3001' && ${param.income} < '10000'}"
> double tax = (amount * (105/100))
</c:when>
<c:when test=" ${param.income} > '10001'}"
> double tax = (amount * (107/100))
</c:when>
</c:choose>
Your tax amount: <c:out value="tax" />
</body>
</html>
Re: Simple tax Calcularot help
Hi! I found your question a interesting one! Did you get the answer to you in the end?
Do you mind sharing it with me? :) Thanks in advance man!!! :)
Re: Simple tax Calcularot help
After 5 years?
Seriously?
Locking the thread.