Display table data in color if meets criteria, JSP

I am getting information from an Oracle database and displaying this data back to a customer's browser using JSP.
In the code snippet, I am calculating the "number of days" from when an item was submitted.
This number is an alias called "Elapsed".

I would like to display the number of the elapsed days as a color, only if it meets the criteria I have shown
below. This works fine, if I use only the != null statement and omit the >= calculation, but not the way have it.
Can someone help me get this working? Thanks!

...
//grab the data and do the math
ResultSet rs = stmt.executeQuery("SELECT ROUND(SYSDATE-SUBMIT_DATE)AS Elapsed FROM MYTABLE");

String elapsedDate = rs.getString("Elapsed");
String eDateColor;

//If elapsed date is greater than 120 days, then display the number in red
if (elapsedDate != null) && > 120 {
      eDateColor = <font color=red>;
        } else {      
  eDateColor = <font color=black>;
 }
 
out.println(" <td><center>" + eDateColor + elapsedDate + "</font></center></td> ");
...                      
ramooreAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rrzCommented:
Just typing mistakes ?  
     eDateColor = "<font color=red>";
       } else {    
  eDateColor = "<font color=black>";
You were missing quotes.  
ramooreAuthor Commented:
Thanks for the comment! Yes, I did forget the quotes, but I am getting a message
"illegal start of expression" which is pointing to the "&&" in the statement. This has to do with my problem somehow.

 if (elapsedDate != null)  && > 120 {
                                    ^
ramooreAuthor Commented:
I think my SQL statement in my resultset does not see the output as a "numeral" or something... so the > 120 is hick-uping on this... don't know.
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

rrzCommented:
>if (elapsedDate != null)  && > 120 {
change to
if (elapsedDate != null  && > 120){
ramooreAuthor Commented:
That didn't do it either, I get the same "... illegal start of..." message, but now pointing to the ">" sign..

if (elapsedDate != null  && > 120) {
                                       ^

and if I do something like this, I get a different message...
"operator > cannot be applied to java.lang.String,int"
...
if (elapsedDate > 120) {
                      ^

am trying some different things..
ramooreAuthor Commented:
I have some data that works out to be "7" for the elapsed number of days. So if I do something like this. that entry shows up in the red color....

if ((elapsedDate != null) && elapsedDate.equals("7")) {

I just can't get ">=" to work
rrzCommented:
sorry I was too quick and didn't think.
if (elapsedDate != null  && elapsedDate> 120){
ramooreAuthor Commented:
Not yet... new message "operator > cannot be applied to java.lang.String,int"
                      
if (elapsedDate != null  && elapsedDate > 120){
                                                          ^
rrzCommented:
Sorry I didn't look closly enough at your code.  
if (elapsedDate != null  && Integer.parseInt(elapsedDate) > 120){

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ramooreAuthor Commented:
That did it! Thanks a bunch for your help, rrz.
rrzCommented:
Great, thanks for the points. But if you have trouble with that later then you might have to  use something like  
int intElapsed = 0;
try {
                      intElapsed = Integer.parseInt(elapsedDate);
} catch (NumberFormatException nfe) {
                      intElapsed = 0;  // or whatever default you want to use
}
if (intElapsed > 120){
ramooreAuthor Commented:
Cool. I'll take your info and do some additional testing on this.. I appreciate your help!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.