Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   variable values in loops (http://www.go4expert.com/forums/variable-values-loops-t4975/)

champion 29Jun2007 14:36

variable values in loops
 
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?

shabbir 29Jun2007 17:13

Re: variable values in loops
 
How this becomes as your introduction.

champion 29Jun2007 21:14

Re: variable values in loops
 
i did my introduction when i registered. this is my second post sir.

shabbir 29Jun2007 22:10

Re: variable values in loops
 
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 30Jun2007 15:04

Re: variable values in loops
 
Its is Java (J2EE)

thnaks

champion 30Jun2007 15:14

Re: variable values in loops
 
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 30Jun2007 22:38

Re: variable values in loops
 
I have moved the thread to Java forum for better and faster responses.


All times are GMT +5.5. The time now is 17:19.