how do you convert a
string to an integer in JSTL?
here
http://osdir.com/ml/jakarta.taglibs.user/2003-12/msg00173.html it says to do:
<c:set var="phNo" value="${1}"/>
to declare an integer, but what if instead of a literal integer there I need to put a param from request? like
<c:set var='phNo' value='${param.pn}' />
I assume ${param.pn} comes in as a string, yes? (just like it would with request.getParameter() ), so how do I convert this to an integer?
I searched long and hard for "JSTL convert string to integer" but did not find much..
essentially I need to do this in JSTL:
String phNo = request.getParameter("pn");
if (phNo == null) {
iPhNo = 1;
} else if (!phNo != null) {
iPhNo = Integer.parseInt(phNo);
}
the answer would be here,
http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_21612706.html
but unfortunately you have to pay to see answers here.. this experts-exchange comes up a lot when searching for stuff, it's a bit frustrating..
a lot of entries are different urls for this same
thread:
http://mail-archives.apache.org/mod_mbox/jakarta-taglibs-user/200401.mbox/%3Cbt7ibi$7fm$1@localhost.localdomain%3E
thank you..