You want to populate forms from actions..

So in an action servlet you use the objects generated by torque and populate the form form there.

e.g.

Iterator it = customerList.iterator();

while(it.hasNext()) {
        Customer cust = (Customer) it.next();
        String fieldName = cust.getFieldName();
        theForm.get("fieldName", fieldName);
}

Or to display in a jsp just feed it to an available context ..

eg

pageContext.setAttribute("myObj",customerList.toArray());
or
request.setAttribute ("myObj",customerList.toArray());
or
session.setAttribute ("myObj",customerList.toArray());

cheers mark

On Thursday, Jun 5, 2003, at 22:46 Europe/London, "" <[EMAIL PROTECTED]> wrote:

Hi,

I am using Torque with Struts.

I need to display some data from database in .jsp file.

I retrieve my data in action class as:

Criteria criteria = new Criteria;
List customerList = CustomerPeer.doSelect(criteria)

Now I have a list populated with objects made by Torque..?

I would like to return a list of formbeans presenting the customer
instead of these objects.

Something like:

List customerList = (myCustomerFormBean)CustomerPeer.doSelect(criteria);

Is it possible to cast a CustomerPeer object to formbean? If not
how should I do this?

Should I even try to return formbeans or is ok to use objects?
Formbeans should be lighter as least???


Thanks in advance,



Ville Kaseva














---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to