Hi,

This problem has been driving me mad!
I have this code (below), which isn't going beyond the "casePapers.add(cp)"
line.
It displays the string "------------------before4------------------"
But doesn't display this string "------------------after------------------"
The CasePaper class has been defined already, with all setter functions with
correct spellings etc.
Why doesn't the add() function work?

The code:

        private String loginId;
        private String password;
        private String typeOfUser;
        private ArrayList<CasePaper> casePapers;
        
        public String execute() {               
                UserManager um=new UserManager();               
                loginId=(String)getSession().get(AwepConstants.LOGINID);
                typeOfUser=(String)getSession().get(AwepConstants.TYPEOFUSER);

                System.out.println("------------------we are
here------------------"+typeOfUser+"------------");
                System.out.println("------------------we are
here------------------"+loginId+"----------");
                System.out.println("------------------we are 
here------------------");
                if (typeOfUser.equals("doctor") || 
typeOfUser.equals("specialist") ||
typeOfUser.equals("patient"))
                {
                        
System.out.println("------------------before------------------" );              
        
                        CasePaper cp=new CasePaper();
                        
                        cp.setCasePaperID("yaa");       
                        cp.setPatientID("yaa");
                        cp.setPID("yaa");                       
                        cp.setDoctorID("yaa");                  
                        cp.setTimeReceived("yaa");                      
                        cp.setTimeViewed("yaa");                        
                        cp.setForwardedToSpec("yaa");                   
                        cp.setTimeViewedBySpec("yaa");                  
                        cp.setAppointmentTime("yaa");                   
                        cp.setUploadedFileID("yaa");                    
                        cp.setQuerySolved("yaa");                       
                        cp.setQuery("yaa");                     
                        cp.setFeePaid("yaa");
                        cp.setFirstName("yaa");
                        cp.setLastName("yaa");
                        cp.setAddress("yaa");
                        cp.setCity("yaa");
                        cp.setCountry("yaa");
                        cp.setGender("yaa");
                        cp.setDateOfBirth("yaa");
                        cp.setBloodGroup("yaa");
                        cp.setWeight("yaa");
                        cp.setDeptID("yaa");
                        cp.setFeeRate("yaa");
                        cp.setRevenue("yaa");                   
                        
System.out.println("------------------before4------------------"        );
                        casePapers.add(cp);//it doesn't go beyond this point
                        
System.out.println("------------------after------------------");
                        //if (casePaper!=null) {return typeOfUser;} else 
{return INPUT;}
                        return typeOfUser;
                }
                return INPUT;
        }//execute
-- 
View this message in context: 
http://www.nabble.com/Problem-with-ArrayList%27s-add%28%29-function-tp21789025p21789025.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to