You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sd9 <sd...@rediffmail.com> on 2009/02/02 13:42:55 UTC
Problem with ArrayList's add() function
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ArrayList's add() function
Posted by Nuwan Chandrasoma <nu...@gmail.com>.
casePapers must be null?
sd9 wrote:
> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ArrayList's add() function
Posted by sd9 <sd...@rediffmail.com>.
And this is the error from catalina.out:
Feb 2, 2009 5:56:00 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Feb 2, 2009 5:56:01 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Feb 2, 2009 5:56:02 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Feb 2, 2009 5:56:41 PM org.apache.tomcat.util.digester.SetPropertiesRule
begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
property 'debug' to '5' did not find a matching property.
Feb 2, 2009 5:56:41 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
/usr/java/jdk1.6.0_10/jre/lib/i386/client:/usr/java/jdk1.6.0_10/jre/lib/i386:/usr/java/jdk1.6.0_10/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
Feb 2, 2009 5:56:41 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 2, 2009 5:56:41 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 407 ms
Feb 2, 2009 5:56:41 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 2, 2009 5:56:41 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Feb 2, 2009 5:56:53 PM org.apache.catalina.loader.WebappClassLoader
validateJarFile
INFO:
validateJarFile(/coe/pst/2008/stru/Desktop/apache-tomcat-6.0.18/webapps/teleconsportal/WEB-INF/lib/servlet-api.jar)
- jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger
(org.apache.myfaces.webapp.StartupServletContextListener).
log4j:WARN Please initialize the log4j system properly.
Feb 2, 2009 5:56:55 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 2, 2009 5:56:55 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 2, 2009 5:56:55 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/37 config=null
Feb 2, 2009 5:56:55 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 13684 ms
------------------we are here------------------doctor------------
------------------we are here------------------abc@gmail.com----------
------------------we are here------------------
------------------before------------------
------------------before4------------------
--
View this message in context: http://www.nabble.com/Problem-with-ArrayList%27s-add%28%29-function-tp21789025p21789059.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ArrayList's add() function
Posted by Dave Newton <ne...@yahoo.com>.
sd9 wrote:
> I had been stuck with this problem for more than 24 hours [...]
...
The stack trace should have pointed to the exact location and error, no?
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ArrayList's add() function
Posted by sd9 <sd...@rediffmail.com>.
God Bless you Nuwan and Nils!!!! :)
I had been stuck with this problem for more than 24 hours and now it's
solved.
Yeah, as you said, I just had to add this "casePapers=new
ArrayList<CasePaper>();"
And it worked!!! :)
Thanks a million!!!
--
View this message in context: http://www.nabble.com/Problem-with-ArrayList%27s-add%28%29-function-tp21789025p21791403.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Problem with ArrayList's add() function
Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Have you actually created the ArrayList?
Nils-H
On Mon, Feb 2, 2009 at 1:42 PM, sd9 <sd...@rediffmail.com> wrote:
>
> 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-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org