aspose file tools*
The moose likes JSP and the fly likes Here is a challenge can't convert Object to int Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Here is a challenge can Watch "Here is a challenge can New topic
Author

Here is a challenge can't convert Object to int

Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
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

Joined: Jan 13, 2002
Posts: 732
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
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

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 ]

Customer surveys are for companies who didn't pay proper attention to begin with.
Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
Thanks very much for the input, Alot to be admired.

Ray Smilgius
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Here is a challenge can't convert Object to int