0
<br><% if (overLimit != null) {%><%=overLimitItemNO.getClass().equals(shoppingVO.getItem_no().getClass())%><%}%>
<br><% if (overLimit != null) {%><%=overLimitItemNO.getClass()%> vs <%=shoppingVO.getItem_no().getClass()%><%}%>
<br><% if (overLimit != null) {%><%=overLimitItemNO%> vs <%=shoppingVO.getItem_no()%><%}%> 
<br><% if (overLimit != null) {%><%=overLimitItemNO == shoppingVO.getItem_no()%><%}%> 

and it shows the following on the browser

true 

class java.lang.Integer vs class java.lang.Integer 

300008 vs 300008 

false
Roman C
  • 49,761
  • 33
  • 66
  • 176
pa pa
  • 43
  • 3

2 Answers2

2

You need to use obj1.equals(obj2). == on objects only compares whether the two are the same exact instance

ControlAltDel
  • 33,923
  • 10
  • 53
  • 80
0

Use .equals when comparing Integer's otherwise you are comparing object refs.

stevebot
  • 23,275
  • 29
  • 119
  • 181