Link to home
Start Free TrialLog in
Avatar of CharleneS77
CharleneS77Flag for United States of America

asked on

How do I use a Vector and a loop to continually display all rows so far in this web app?

I am working on an EmployeeTest web app.  I have been trying to modify my web app so that I can continually display all of the rows each time a new row is added (display all of the added employees so far).  My web app is attached (EmployeeTest).  Remove the .txt extensions from each file except for the departments.txt file.  I am using Java 6 and Tomcat 6.  

I am able to successfully run the web app if I comment out my attempted modifications.  The files I need help with are confirmation.jsp and HiringServlet.java.  The code I need help with in each of these files is located between a set of 2 comment lines in each of these files, so it is very easy to locate.  The code I have attempted is commented out, so you should be able to successfully run the web app without making any initial changes.  

In my many attempts to reach success, I have created a separate (very small) web app (Display_Names) which does continually add all of the rows so far.  I have also attached the Display_Names web app.  If someone can even point out the reason why my Display_Names web app works and compare it to my EmployeeTest web app, that may be enough to set me on the right track.

I really need some assistance with this.  I have been trying to get it to work for over a week, and I am still not able to see what I am doing wrong.  Any help is extremely appreciated!  Thank you in advance.  

EmployeeTest.zip
Display-Names.zip
Avatar of bertlanq
bertlanq
Flag of United States of America image

i don't have tomcat installed with java, but i would like to try and help you
maybe we can do some desktop sharing and work together on your pc
im avail through my profile if you'd like that
Avatar of CharleneS77

ASKER

Do you see the problem?
bertlang,

The screenshots you requested are attached.  Please let me know if you need any other screenshots.  

Thank you.
emp-test-form-JSP.bmp
emp-test-param-verif.bmp
emp-test-without-error.bmp
emp-test-my-error.bmp
display-names.bmp
I have narrowed down the problem to be the lines 143 and 144 in HiringServlet.java:

ArrayList >employeeInfo = (ArrayList>)request.getAttribute("empInfo");

The employeeInfo ArrayList is still null after this statement.  Also, from what I can tell, that is the last statement to execute in the program.  

What am I doing wrong when I attempt to declare and initialize the employeeInfo ArrayList?  
What is stopping the program from getting to the next line?


ASKER CERTIFIED SOLUTION
Avatar of CharleneS77
CharleneS77
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rrz
>static ArrayList >employeeInformation = new ArrayList>();  
I would not make it static.  I would make the ArrayList a session scoped object.  
Have you found a solution ?  
If not, then  post your lastest code.
>>>>I would make the ArrayList a session scoped object.

Thank you, I will change it.


>>>>Have you found a solution ?

(See my last post above yours)"Nevermind, I got it! I created a new ArrayList object at the top of HiringServlet.java and I added the following code between the commented lines.Nevermind, I got it! I created a new ArrayList object at the top of HiringServlet.java and I added the following code between the commented lines."
Oops, didn't mean to paste the last line twice.