-2
如何創建計算稅款的JSP頁面?我們必須使用正則表達式來驗證用戶輸入。提交表單後,用戶將看到稅額。稅率根據以下稅表計算。您還需要將currencySymbol="$"
添加到<fmt:formatNumber>
標記。JSTL Web應用程序開發
Total Income Tax Rate
$1 - $5000 0%
$5001 - $20000 5%
$20001 and above 7%
<%@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>Assignment One - Queston 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}" />
<c:if test='${empty param.income}'>
<c:set var="amount" value="0"/>
</c:if>
<b>Enter the amount of total income for this year:</b>
<form name="thisForm" action="Q4.jsp" method="post"
onsubmit="return verify();">
Amount of sales:<input name=income size=10 value="?"> <br/><br/>
<input type=submit value="Calculate Tax">
</form>
<%-- Put Code to calculate the tax here --%>
</body>
</html>
以上是當前代碼我現在有。有人能幫我嗎?