Custom JSP taglib. Lets you provide a "human test" for you input.
Tag MathQuestion generates a random expression and saves it result in session scope.
You can ask about this result in your HTML form and compare the input with the value
saved in session. It could be a proof that your page is not submitted from some automated application.
For example:
<%@ taglib uri="taglib.tld" prefix="q" %>
<form ... >
<q:MathQuestion />
<%=_Expression%> = <input type="text" name="answer">
...
</form>
in your servlet (JSP page) processes the input you can compare two value:
session.getAttribute("_Answer") and request.getParameter("answer").
Actually tag creates the following page scope variables:
_Expression (type is java.lang.String) - generated expression
_Operand1 (type is java.lang.Integer) - the first operand
_Operation (type is java.lang.String) - generated operation
_Operand2 (type is java.lang.Integer) - the second operand
_Answer (type is java.lang.Integer) - the answer. This value is saved also in the session scope.
Tags are:
MathQuestion
tag generates a random question. Parameters are: none
for downloading:
Library: mquestiontag.jar Description: taglib.tld
© Coldbeans Comments, suggestions?
See also Coldtags suite - the largest collection of custom JSP tags.