dcsimg
How do I access a Session in a JSP
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   lihp_savohcsom
Posted On:   Wednesday, September 25, 2002 01:59 PM

I'm new to all this so bear with me. I've got a class that uses an sql query to obtain a list of employees and then stores that list in a session. EmployeeDAO employeeDAO = new EmployeeDAO(); employees = employeeDAO.findAll(); session.setAttribute( Constants.EMPLOYEE_LIST, employees ); On my jsp page, I'm trying to access my employee list but it is null. Employee empList = (Employee)session.getAttribute("Constants.EMPLOYEE_LIST"); I know the records are there. I'm just confused how to access my list. I've tried vectors and lists but nothing seems to work. Thanks    More>>

I'm new to all this so bear with me.



I've got a class that uses an sql query to obtain a list of employees and then stores that list in a session.


			
EmployeeDAO employeeDAO = new EmployeeDAO();
employees = employeeDAO.findAll();

session.setAttribute( Constants.EMPLOYEE_LIST, employees );


On my jsp page, I'm trying to access my employee list but it is null.

			
Employee empList = (Employee)session.getAttribute("Constants.EMPLOYEE_LIST");



I know the records are there. I'm just confused how to access my list. I've tried vectors and lists but nothing seems to work.




Thanks    <<Less

Re: How do I access a Session in a JSP

Posted By:   AlessandroA_Garbagnati  
Posted On:   Wednesday, September 25, 2002 02:02 PM

Hi,

sorry, but according to your line:

session.setAttribute( Constants.EMPLOYEE_LIST, employees );

you should do:

Employee empList = (Employee)session.getAttribute(Constants.EMPLOYEE_LIST);
About | Sitemap | Contact