hashmap problem

[is there any problem with this code, when i try to get the hashmap values at my jsp page i get null values...pls help

code]

HashMap responseMap=new HashMap();

HashMap newValues = new HashMap();

try

{

int runsScoredAsInt = Integer.valueOf(runsScoredAsString).intValue();

int overAsInt = Integer.valueOf(overOnly).intValue();

float ballNoAsFloat = Float.valueOf(ballNoOnly).floatValue();

int widesAsInt = Integer.valueOf(widesAsString).intValue();

int byesAsInt = Integer.valueOf(byesAsString).intValue();

int noBallsAsInt = Integer.valueOf(noBallsAsString).intValue();

if (runsScoredAsInt % 2 == 1)

{

String temp = "";

temp = battingId;

battingId = nonBattingId;

nonBattingId = temp;

System.out.println("battingId"+battingId);

System.out.println("nonBattingId"+nonBattingId);

newValues.put("battingId",battingId);

newValues.put("nonBattingId",nonBattingId);

}else {

battingId=battingId;

System.out.println("battingId"+battingId);

nonBattingId=nonBattingId;

System.out.println("nonBattingId"+nonBattingId);

}

HashMap overMap = new HashMap();

if (widesAsInt==0 && noBallsAsInt==0)

{

ballNoAsFloat +=0.1f;

System.out.println("ballNoAsFloat"+ballNoAsFloat);

if (ballNoAsFloat>=0.7)

{

overAsInt +=1;

System.out.println("Over"+overAsInt);

ballNoAsFloat=0.1f;

System.out.println("ballNoAsFloat"+ballNoAsFloat);

newValues.put("ballNoAsFloat",ballNoAsFloat);

newValues.put("overAsInt",overAsInt);

}

}else {

ballNoAsFloat=ballNoAsFloat;

System.out.println("ballNoAsFloat"+ballNoAsFloat);

}

responseMap.put("newValueList",newValues);

}

catch (Exception e)

{

e.printStackTrace();

}

return responseMap;

}

[/code]

i get my hash map values in jsp as

HashMap newValueList=(HashMap)updatedStatus.get("newValueList");

String newBattingId=(String)newValueList.get("battingId");

String ballNoAsFloat=(String)newValueList.get("ballNoAsFloat");

System.out.println("newBattingId"+newBattingId);

System.out.println("ballNoAsFloat"+ballNoAsFloat);

[2300 byte] By [@chillzonea] at [2007-11-27 3:50:21]
# 1

else parts are executing in your code. This is the reason for getting Null values in your jsp.

else {

battingId=battingId;

System.out.println("battingId"+battingId);

nonBattingId=nonBattingId;

System.out.println("nonBattingId"+nonBattingId);

}

second else

else {

ballNoAsFloat=ballNoAsFloat;

System.out.println("ballNoAsFloat"+ballNoAsFloat);

}

check your code

AnanSmritia at 2007-7-12 8:54:16 > top of Java-index,Java Essentials,New To Java...