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
  • 48,723
  • 33
  • 63
  • 158
pa pa
  • 33
  • 2

2 Answers2

2

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

ControlAltDel
  • 32,042
  • 9
  • 48
  • 75
0

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

stevebot
  • 22,431
  • 27
  • 117
  • 179