Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Here is a challenge can't convert Object to int  RSS feed

 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code:
Error: 500
Location: /inscope/inc/inscopeLayout.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\Tomcat\work\localhost_8080%2Finscope\_0002finc_0002finscopeLayout_0002ejspinscopeLayout_jsp_4.java:39: Incompatible type for >. Can't convert java.lang.Object to int.
if ((session.getAttribute("Browser").equals("NETSCAPE")) && ((session.getAttribute("BrowserVer") >= 4))){
I need to compare the Browser Version greater then 4 or equal
Thanks Ray
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i assume the getAttribute returns an object which u can convert to string right?
so cast the object to String and then use parseInt on it to turn it into an int.
hope it helps.
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Save yourself some trouble. When you store the attribute into the session for the browser version, don't store it as a string. I'm presuming that you're doing this from a "snooper" page since you're looking at session attributes instead of headers here.

Then on the query end, you can just do:

[ January 22, 2002: Message edited by: Tim Holloway ]
 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for the input, Alot to be admired.

Ray Smilgius
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!