You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Tim Müller-Seydlitz <tm...@nagler-company.com> on 2003/11/06 08:59:44 UTC

Handling of multiple objects in a context

Hi,

I would like to display the results of multiple queries in a page.

However, the method context.put doesn't allow me to transfer multiple result sets to the page. A second query is not executed after a call to context.put.

For example this type of code doesn't work as expected.

           Criteria criteria = new Criteria();
            criteria.add(LimittenorPeer.LIMITTYPEID, "2");
           Limittenor limittenor = (Limittenor) LimittenorPeer.doSelect(criteria);
	   context.put("limittenors", limittenor);
	   Criteria criteria2 = new Criteria();
	   List list = LimittypePeer.doSelect(criteria2);
	   context.put("limittypes", list,"limittenors", limittenor);

Thanks for your help

Regards,
Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: Handling of multiple objects in a context

Posted by Gavin <ga...@genixsystems.com>.
To me it looks like the problem is this line

	   context.put("limittypes", list,"limittenors", limittenor);

The API for org.apache.velocity.context.Context defines put(String, Object)
so this line is just plain old wrong.

Anyway, limittenor hasn't changed since you first put it into the context,
so why the need to put in again???

And if you do need multiple object in the context just have as many
context.put calls as you need objects in the context

  
Gavin Barron B.Sc.
J2EE Developer
Genix Systems Ltd
http://www.genixsystems.com/

"Never underestimate the bandwidth of a station wagon full of hard drives"
-----Original Message-----
From: Tim Muller-Seydlitz [mailto:tms@nagler-company.com] 
Sent: Thursday, 6 November 2003 9:00 p.m.
To: turbine-user@jakarta.apache.org
Subject: Handling of multiple objects in a context

Hi,

I would like to display the results of multiple queries in a page.

However, the method context.put doesn't allow me to transfer multiple result
sets to the page. A second query is not executed after a call to
context.put.

For example this type of code doesn't work as expected.

           Criteria criteria = new Criteria();
            criteria.add(LimittenorPeer.LIMITTYPEID, "2");
           Limittenor limittenor = (Limittenor)
LimittenorPeer.doSelect(criteria);
	   context.put("limittenors", limittenor);
	   Criteria criteria2 = new Criteria();
	   List list = LimittypePeer.doSelect(criteria2);
	   context.put("limittypes", list,"limittenors", limittenor);

Thanks for your help

Regards,
Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org