You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ecs-user@jakarta.apache.org by "RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" <al...@monsanto.com> on 2001/03/20 22:07:24 UTC

Returning an object containing various HTML objects

Hello:

I am creating a method which needs to return an
object which contains 3 HTML tables and a few other
HTML objects.  I want to basically return an object
which contains all these elements.

How can I do this? What class type would this method
have to return.? How can I "concatenate" all the HTML
objects I need to use without using the body tag?

For example:

public ???  create questionPanel()
{
    Table firstTable  = new Table();
    Table secondTable = new Table();
    Table thirdTable  = new Table();
       .
       .
       .
     Other Objects.....

      ....add all objects together

     return ????;    
}


Any help would greatly be appreciated.

Thanks:
Alex Restrepo

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


Re: Returning an object containing various HTML objects

Posted by Ricardo Neisse <ri...@cnpt.embrapa.br>.
Hi !!
You can use ElementContainer instead...
return new ElementContainer()
    .addElement(table1)
    .addElement(table2)
    .addElement(table3);
;)
Ricardo Neisse - ricardo@cnpt.embrapa.br

> "RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:
>
> > Hello:
> >
> > I am creating a method which needs to return an
> > object which contains 3 HTML tables and a few other
> > HTML objects.  I want to basically return an object
> > which contains all these elements.
> >
> > How can I do this? What class type would this method
> > have to return.? How can I "concatenate" all the HTML
> > objects I need to use without using the body tag?
> >
> > For example:
> >
> > public ???  create questionPanel()
> > {
> >     Table firstTable  = new Table();
> >     Table secondTable = new Table();
> >     Table thirdTable  = new Table();
> >        .
> >        .
> >        .
> >      Other Objects.....
> >
> >       ....add all objects together
> >
> >      return ????;
> > }
> >
> > Any help would greatly be appreciated.
>
> Here is one way to do it, there are a couple others as well.
>
> StringElement se = new
> StringElement().addElement(firstTable).addElement(secondTable).addElement(thirdTable);
>
> or alternativly just write the tables directly to the output stream
> like:
>
> public void createQuestionPanel(PrintWriter out)
> {
>     Table firstTable  = new Table();
>     Table secondTable = new Table();
>     Table thirdTable  = new Table();
>        .
>        .
>        .
>      Other Objects.....
>
>       ....add all objects together
>
>      firstTable.output(out);
>      secondTable.output(out);
>      thirdTable.output(out);
> }
>
> -stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ecs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ecs-user-help@jakarta.apache.org


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


RE: Returning an object containing various HTML objects

Posted by David Ethell <de...@sscdinc.com>.
Or, write them all as Strings and return a string:

public String create questionPanel()
{
    String returnString = "";
    Table firstTable  = new Table();
    Table secondTable = new Table();
    Table thirdTable  = new Table();
       .
       .
       .
     Other Objects.....

      ....add all objects together
    returnString += firstTable.toString();
    returnString += secondTable.toString();
    returnString += thirdTable.toString();
    returnString += otherObjects.toString();
     return (returnString);    
}

> -----Original Message-----
> From: snagy@mail.catalystsolutions.net
> [mailto:snagy@mail.catalystsolutions.net]On Behalf Of Stephan Nagy
> Sent: Tuesday, March 20, 2001 6:14 PM
> To: ecs-user@jakarta.apache.org
> Subject: Re: Returning an object containing various HTML objects
> 
> 
> "RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:
> 
> > Hello:
> >
> > I am creating a method which needs to return an
> > object which contains 3 HTML tables and a few other
> > HTML objects.  I want to basically return an object
> > which contains all these elements.
> >
> > How can I do this? What class type would this method
> > have to return.? How can I "concatenate" all the HTML
> > objects I need to use without using the body tag?
> >
> > For example:
> >
> > public ???  create questionPanel()
> > {
> >     Table firstTable  = new Table();
> >     Table secondTable = new Table();
> >     Table thirdTable  = new Table();
> >        .
> >        .
> >        .
> >      Other Objects.....
> >
> >       ....add all objects together
> >
> >      return ????;
> > }
> >
> > Any help would greatly be appreciated.
> 
> Here is one way to do it, there are a couple others as well.
> 
> StringElement se = new
> StringElement().addElement(firstTable).addElement(secondTable).add
> Element(thirdTable);
> 
> or alternativly just write the tables directly to the output stream
> like:
> 
> public void createQuestionPanel(PrintWriter out)
> {
>     Table firstTable  = new Table();
>     Table secondTable = new Table();
>     Table thirdTable  = new Table();
>        .
>        .
>        .
>      Other Objects.....
> 
>       ....add all objects together
> 
>      firstTable.output(out);
>      secondTable.output(out);
>      thirdTable.output(out);
> }
> 
> -stephan
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ecs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ecs-user-help@jakarta.apache.org

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


Re: Returning an object containing various HTML objects

Posted by Stephan Nagy <sn...@connectria.com>.
"RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:

> Hello:
>
> I am creating a method which needs to return an
> object which contains 3 HTML tables and a few other
> HTML objects.  I want to basically return an object
> which contains all these elements.
>
> How can I do this? What class type would this method
> have to return.? How can I "concatenate" all the HTML
> objects I need to use without using the body tag?
>
> For example:
>
> public ???  create questionPanel()
> {
>     Table firstTable  = new Table();
>     Table secondTable = new Table();
>     Table thirdTable  = new Table();
>        .
>        .
>        .
>      Other Objects.....
>
>       ....add all objects together
>
>      return ????;
> }
>
> Any help would greatly be appreciated.

Here is one way to do it, there are a couple others as well.

StringElement se = new
StringElement().addElement(firstTable).addElement(secondTable).addElement(thirdTable);

or alternativly just write the tables directly to the output stream
like:

public void createQuestionPanel(PrintWriter out)
{
    Table firstTable  = new Table();
    Table secondTable = new Table();
    Table thirdTable  = new Table();
       .
       .
       .
     Other Objects.....

      ....add all objects together

     firstTable.output(out);
     secondTable.output(out);
     thirdTable.output(out);
}

-stephan


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