variable values in loops

Light Poster
29Jun2007,14:36   #1
champion's Avatar
Code:
//Define Iterator iter

String policyPath = "";
while (iter.hasNext()) 
{
deductionL = (DeductionsLocal) iter.next();

String policyID = deductionL.getPolicyID();

policyL = policyH.findByPrimaryKey(policyID);

if(policyL.getStatus().equalsIgnoreCase("READY TO GO INTO FORCE")||policyL.getStatus().equalsIgnoreCase("IN FORCE"))
	policyPath = "/NewBusiness/displayPolicyApproved.jsp"; 
else
	policyPath = Utils.getPolicyPath(policyL.getNextAction());



//other code
//end loop
}
why is it that policyPath has nothing for the rest of the iterations?

Last edited by shabbir; 29Jun2007 at 17:08.. Reason: Code block
Go4Expert Founder
29Jun2007,17:13   #2
shabbir's Avatar
How this becomes as your introduction.
Light Poster
29Jun2007,21:14   #3
champion's Avatar
i did my introduction when i registered. this is my second post sir.
Go4Expert Founder
29Jun2007,22:10   #4
shabbir's Avatar
Quote:
Originally Posted by champion
i did my introduction when i registered. this is my second post sir.
Then you should be making the post in the relevant section. For now I could not get if its C# or Java so I have not moved it for you.
Light Poster
30Jun2007,15:04   #5
champion's Avatar
Its is Java (J2EE)

thnaks
Light Poster
30Jun2007,15:14   #6
champion's Avatar
Code Java J2EE

if(policyL.getStatus().equalsIgnoreCase("READY TO GO INTO FORCE")||policyL.getStatus().equalsIgnoreCase("IN FORCE"))
policyPath = "/NewBusiness/displayPolicyApproved.jsp";
else
policyPath = Utils.getPolicyPath(policyL.getNextAction());

I have found why it was not retaining anything. it is because when the if is not executed the else is executed but it retains an empty string because the argument policyL.getNextAction was not catered for in my Utils.getPolicyPath. i have managed to impliment it. thanks guys.
Go4Expert Founder
30Jun2007,22:38   #7
shabbir's Avatar
I have moved the thread to Java forum for better and faster responses.