problem with servlet code

hello guys...i am having some problems..the application runs fine until it reaches this bit of code..

if(mode=="w"){

System.out.println(" mode is weekly");

try{

ps4 =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, 7) WHERE pid=?");

ps4.setInt(1, tid);

ps4.setInt(2, pid);

ps4.executeUpdate();

}

catch(SQLException e1){

e1.printStackTrace();

}

}

else if(mode=="m"){

System.out.println(" mode is monthly");

try{

ps4 =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, 31) WHERE pid=?");

ps4.setInt(1, tid);

ps4.setInt(2, pid);

ps4.executeUpdate();

System.out.println(" property update query executed");

}

catch(SQLException e2){

System.out.println("property update Query not executed");

e2.printStackTrace();

}

}

whats wrong with it?

the log doesnt have any report printed in it for some reasons..which is quite a surprise since i have printStackTrace..please note that there are two queries precceeding this one and they all run to perfection and output suitable messages in the log..

whats wrong with this part?

please help

[1288 byte] By [ketsona] at [2007-10-3 0:46:37]
# 1

You are using == to compare string which is wrong use .equals() method

And restructure you code as follows

if (mode.equals("w"))

updatePropertySet(tid,pid,7);

else if (mode.equals("m"))

updatePropertySet(tid,pid,31);

else

throw new SomeException();

private void updatePropertySet(int tid, int pid, int days){

try{

PreparedStatement ps =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, ?) WHERE pid=?");

ps.setInt(1, tid);

ps.setInt(2,days);

ps.setInt(3, pid);

ps.executeUpdate();

}catch(SQLException e){

e.printStackTrace();

}

}

LRMKa at 2007-7-14 17:41:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
i am still getting no result.. and no report in log either,,,the whole page just go blank...
ketsona at 2007-7-14 17:41:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Are you sending any out put from your doGet/doPost method to be displayed on the browser?. If so can you post those code
LRMKa at 2007-7-14 17:41:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

no i am not sending anything to be displayed..once the queries are executed, i simply go back to the welcome page..

ps. i must say that the entrire servlet has 4 queries. and this is the last one..the first three work fine but somehown there is a problem with this one...

is there any such thing as a maximum number of queries in a class?

ketsona at 2007-7-14 17:41:28 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...