vendredi 19 septembre 2014

JSP trying to convert String to Long


Vote count:

0




I have a <td> in my jsp which has a <spring:bind> tag.



<td>
<spring:bind path="mailListRequest.offSeason">
<select name="<c:out value="${status.expression}" />" id="<c:out value="${status.expression}" />">
<option value="0">Select</option>
<c:forEach var="t" begin="2" step="1" end="5">
<option value="<c:out value="${t} star"/>" <c:if test="${status.value eq t}"> selected</c:if>><c:out value="${t} star"/>
</option>
</c:forEach>
<option value="boutique hotels">boutique hotels</option>

</select>
</spring:bind>
</td>


"mailListRequest.offSeason" is a string on the server side (Java). The goal here is to iterate in the <c:forEach..> loop variable "t". Therefore the iteration will be 2,3,4,5;and in the <option value..> I've made each iteration return a value with the string/word star in front of it therefore the output would be 2 star, 3 star, 4 star....


The Issue:

The issue is that whenever I choose one of the options in the <c:forEach> loop or the option "botique hotels " I keep getting an error in my JSP:


Error

javax.servlet.jsp.JspTagException: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${status.value eq t}": An exception occured trying to convert String "2 star" to type "java.lang.Long" (null).


Which puzzles me because "mailListRequest.offSeason" is set as a string and the values in my options are String values(I PRESUME). Perhaps it's the <option value="<c:out value="${t} star"/> I'm formatting wrong.



asked 2 mins ago

Arty

59






JSP trying to convert String to Long

Aucun commentaire:

Enregistrer un commentaire