variable values in loops

champion's Avatar, Join Date: May 2007
Light Poster
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
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
How this becomes as your introduction.
champion's Avatar, Join Date: May 2007
Light Poster
i did my introduction when i registered. this is my second post sir.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.
champion's Avatar, Join Date: May 2007
Light Poster
Its is Java (J2EE)

thnaks
champion's Avatar, Join Date: May 2007
Light Poster
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.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
I have moved the thread to Java forum for better and faster responses.