I'm having difficulty declaring and using numeric variables with the JSTL. It appears that when setting a variable whos value I retreive from an object in the request, I always get a String and I am unable to do math with it. eg:

<c:set var="pagesUnformatted"
value="${requestScope.report.recordCount / reqeustScope.report.recPerPage}" />
<c:out value="${pagesUnformatted}" />
<fmt:formatNumber value="${pagesUnformatted}" maxFractionDigits="0" var="pages" />
<c:out value="${pages}" />

The first out statement prints "Infinity". The second one produces no output.

If I change one of the variable names in my divide-by statement to a number, I get an error stating that:

javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "value" with value "${pageScope.recordCount / 25}": An exception occured trying to convert String "number(requestScope.report.recordCount)" to type "java.lang.Double"

Thanks for your help in advance. I think I'm just missing something about these variables conceptually.

~Austin Lowry


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to