Got probs with my coding.
Actually, the rest of my friends also. Can someone help me with JSP server-side coding?
our cher nv explain properly, just write it down for us, then tell us to do the rest. and tml's the submission date. we found out all of us dunno how to do. =X
need it to validate full Singapore NRIC number.
the following is the copy n paste from my teacher's codes..
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%-- NRIC VALIDATION --%>
<c:set var="uNRIC" value="S8847079F" />
<%-- Define constant required --%>
<c:set var="weight" value="2,7,6,5,4,3,2" />
<c:set var="checkDigit" value="ABCDEFGHIZJ" />
<c:set var="nricDigit" value="${fn:substring(uNRIC,1,8)}" />
Extracted NRIC : ${nricDigit} <br/>
<!-- Add together each procedure -->
<c:set var="sum" value="0" />
<c:set var="pos" value="0" />
<c:forEach var="" items="${weight}">
<c:set var="sum" value="${sum+fn:substring(nricDigit,pos,pos+1)*nricDigit}" />
<c:set var="pos" value="${pos + 1}" />
</c:forEach>
Sum of the products : ${sum} <br/>
<!-- Subtract the remainder from 11 to give the check digit -->
<c:set var="cDigit" value= "${11 - sum%11}" />
Check Digit ${cDigit} <br/>
<!-- Reference to the check digit table -->
${fn:substring (checkDigit,cDigit-1,cDigit)}
<c:if>
CONT FROM HERE
any kind soul can help?


Linear Mode
