• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Here is a challenge can't convert Object to int

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much for the input, Alot to be admired.

Ray Smilgius
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic