Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to send object arraylist from servlet to jsp and display using jstl

807580Sep 15 2009 — edited Sep 17 2009
Hi All....

I have a simple application and problem with it.

Once user logged in to system the user will redirect to LoginServlet.java controller.
Then in LoginServlet I want to redirect user to another page called book_details.jsp.

this is my login servlet.
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out = response.getWriter();
		ArrayList<BankAccountDTO> account_list = new ArrayList();
		ResultSet resultSet = null;
		LowFairAirDB airDB = null;
		try{
			
			airDB = new LowFairAirDB();
			String query = "SELECT account_id, type, description, balance, credit_line, begin_balance, begin_balance_time_stamp FROM bank_account";
			airDB.sqlSelect(query);
			resultSet = airDB.getResultSet();
			while(resultSet.next()){
				account_list.add(new BankAccountDTO(resultSet.getInt(1),
													resultSet.getInt(4),
													resultSet.getInt(5),
													resultSet.getInt(6),
													resultSet.getString(2),
													resultSet.getString(3),
													resultSet.getString(7)));
				
			}
			
			
			
		}catch(Exception ex){
			
			
		}finally{
			try{resultSet.close();}catch(Exception ex){}
			airDB.sqlClose();
			
		}
		
		
		
	}
I set bank account values to BankAccountDTO.java objects and add them to the arrayList.
Next I want to send this objects arrayList to books_details.jsp and wanna display each objects values using JSTL.
I still finding a way to go through this.

1. Can anyone say how can I do it?
2. Is there any other method to do the same thing without using JSTL?


thanks in advance,
Dil.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2009
Added on Sep 15 2009
11 comments
18,662 views