cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beyaNet Consultancy <beya...@ntlworld.com>
Subject How to determine if a session object has already been created
Date Wed, 14 Apr 2004 21:53:54 GMT
Hi,
How do I determine, in XSP:LOGIC, whether a session object has already 
been created? Basically I am trying to persist an object, in this case 
an Order object, in a session:

				//1.Determine if an order has been created
				Order newOrder = (Order)session.getAttribute("ORDER");
				
				if (newOrder == null){
					newOrder = new Order();
				}
				
				//2.check that stock exists
				Stock newStk = 
InsertOrder.checkStock("d1e22501fbd4255600fbd42559d30001");
				
				//3.Add stock item
				newOrder.addProduct(newStk,1,32);
				
				//4.Update Session object
				session.setAttribute("ORDER", newOrder);

The problem is that the if statement is not working, and as a result a 
new Order object is being created on each pass of the page. What am I 
doing wrong?

Peter
Mime
View raw message