Solve Error java.lang.NumberFormatException: For input string: “id” in jstl

How to Solve error Caused by: java.lang.NumberFormatException: For input string: “id” ┬áin JSP, JSTL.

The error message “java.lang.NumberFormatException: For input string: ‘id'” indicates, The Id is returning a string value but to perform operations, we need the id into as a long or int.

Convert String value into Long or integer into JSTL

<%@ taglib uri="" prefix="c" %>

<c:set var="myString" value="1234" />
<c:set var="myInt" value="${myString}" />

<p>My integer value is ${myInt}</p>

the c:set tag is used to set the value of the myString variable to the string “1234”. The myString variable is then used as the value for the myInt variable. Since JSTL automatically converts strings to their appropriate data type, the string value of myString is automatically converted to an integer value for myInt.