You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jaya Shankar <sh...@knoahindia.com> on 2003/03/21 10:49:14 UTC

hi a problem - Shank

Hi all

How do I populate a jsp with DB field values, just up on loading the page in
the browser using struts framework?

Thanks in advance
shank

----- Original Message -----
From: <Mi...@ubsw.com>
To: <st...@jakarta.apache.org>
Sent: Friday, March 21, 2003 3:09 PM
Subject: RE: creating my Class


That depends, if you are going to have 1 Class per Record, then you could do
something like:
But if you need to reference each record by name, then you can either add a
"name Attribute to the Record like:

class Record {
private String name;
private ArrayList record;

public void setSubRecord(Record subRecord){...}
public Record getSubRecord(String recordName){
   loop...
       if( record.getName().equals(recordName) )
           return record;
}

public void setName(String name){...}
public String getName(){...}

}

Then you can just search each RecordObject in the ArrayList.

Of coarse you can always look at a HashMap as well.

  _____

Thank You

Mick Knutson

Sr. Designer - Project Trust
aUBS AG, Financial - Zürich
Office: +41 (0)1/234.42.75
Internal: 48194
Mobile: 079.726.14.26
  _____



-----Original Message-----
From: Richard Raquepo [mailto:rraquepo@primeorion.com]
Sent: Friday, March 21, 2003 10:22 AM
To: Struts Users Mailing List
Subject: Re: creating my Class


how can show my record-subrecord?

    Record1    blah    blah
        Record1_sub_detail1    blah
        Record1_sub_detail1    blah
        Record1_sub_detail1    blah
    Record2    blah
    Record3    blah
        Record3_sub_detail1    blah

how will i put data and how will the matching be made.
i mean assuming i have a integer key, how is it done then.

 maybe you can show me some java code i will really appreciate it. thanks.


----- Original Message -----
From: <Mi...@ubsw.com>
To: <st...@jakarta.apache.org>
Sent: Friday, March 21, 2003 5:08 PM
Subject: RE: creating my Class


an ArrayList will hold Objects. an ArrayList is an object itself. So, the
ArrayList could contain other ArrayList's in it.


  _____

Thank You

Mick Knutson

Sr. Designer - Project Trust
aUBS AG, Financial - Zürich
Office: +41 (0)1/234.42.75
Internal: 48194
Mobile: 079.726.14.26
  _____



-----Original Message-----
From: Richard Raquepo [mailto:rraquepo@primeorion.com]
Sent: Friday, March 21, 2003 10:12 AM
To: Struts Users Mailing List
Subject: creating my Class


I am in the process of designing a class but coudn't figure out how to start
it because i'm thinking how
struts tags will display my info.

My expected output is like this

    Record1    blah    blah
        Record1_sub_detail1    blah
        Record1_sub_detail1    blah
        Record1_sub_detail1    blah
    Record2    blah
    Record3    blah
        Record3_sub_detail1    blah

I don't how will be the data type of my class probably it will look like
this:

    class Record {
        ArrayList record;
        ArrayList subrecord[];
    }


r really don't what to use really. Can someone give me some idea and also
how will i be able to display it in
my JSP using struts tags.

thanks a lot.

-Richard

Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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




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


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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


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


Re: hi a problem - Shank

Posted by Navjot Singh <na...@net4india.net>.
Go through the <action> tag with "type" attribute (your class) defined
taking the values from DB and passing on to the jsp after "forwarding".

hope you got what i am trying to say ;-)
-navjot

----- Original Message -----
From: "Jaya Shankar" <sh...@knoahindia.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, March 21, 2003 3:19 PM
Subject: hi a problem - Shank


| Hi all
|
| How do I populate a jsp with DB field values, just up on loading the page
in
| the browser using struts framework?
|
| Thanks in advance
| shank
|
| ----- Original Message -----
| From: <Mi...@ubsw.com>
| To: <st...@jakarta.apache.org>
| Sent: Friday, March 21, 2003 3:09 PM
| Subject: RE: creating my Class
|
|
| That depends, if you are going to have 1 Class per Record, then you could
do
| something like:
| But if you need to reference each record by name, then you can either add
a
| "name Attribute to the Record like:
|
| class Record {
| private String name;
| private ArrayList record;
|
| public void setSubRecord(Record subRecord){...}
| public Record getSubRecord(String recordName){
|    loop...
|        if( record.getName().equals(recordName) )
|            return record;
| }
|
| public void setName(String name){...}
| public String getName(){...}
|
| }
|
| Then you can just search each RecordObject in the ArrayList.
|
| Of coarse you can always look at a HashMap as well.
|
|   _____
|
| Thank You
|
| Mick Knutson
|
| Sr. Designer - Project Trust
| aUBS AG, Financial - Zürich
| Office: +41 (0)1/234.42.75
| Internal: 48194
| Mobile: 079.726.14.26
|   _____
|
|
|
| -----Original Message-----
| From: Richard Raquepo [mailto:rraquepo@primeorion.com]
| Sent: Friday, March 21, 2003 10:22 AM
| To: Struts Users Mailing List
| Subject: Re: creating my Class
|
|
| how can show my record-subrecord?
|
|     Record1    blah    blah
|         Record1_sub_detail1    blah
|         Record1_sub_detail1    blah
|         Record1_sub_detail1    blah
|     Record2    blah
|     Record3    blah
|         Record3_sub_detail1    blah
|
| how will i put data and how will the matching be made.
| i mean assuming i have a integer key, how is it done then.
|
|  maybe you can show me some java code i will really appreciate it. thanks.
|
|
| ----- Original Message -----
| From: <Mi...@ubsw.com>
| To: <st...@jakarta.apache.org>
| Sent: Friday, March 21, 2003 5:08 PM
| Subject: RE: creating my Class
|
|
| an ArrayList will hold Objects. an ArrayList is an object itself. So, the
| ArrayList could contain other ArrayList's in it.
|
|
|   _____
|
| Thank You
|
| Mick Knutson
|
| Sr. Designer - Project Trust
| aUBS AG, Financial - Zürich
| Office: +41 (0)1/234.42.75
| Internal: 48194
| Mobile: 079.726.14.26
|   _____
|
|
|
| -----Original Message-----
| From: Richard Raquepo [mailto:rraquepo@primeorion.com]
| Sent: Friday, March 21, 2003 10:12 AM
| To: Struts Users Mailing List
| Subject: creating my Class
|
|
| I am in the process of designing a class but coudn't figure out how to
start
| it because i'm thinking how
| struts tags will display my info.
|
| My expected output is like this
|
|     Record1    blah    blah
|         Record1_sub_detail1    blah
|         Record1_sub_detail1    blah
|         Record1_sub_detail1    blah
|     Record2    blah
|     Record3    blah
|         Record3_sub_detail1    blah
|
| I don't how will be the data type of my class probably it will look like
| this:
|
|     class Record {
|         ArrayList record;
|         ArrayList subrecord[];
|     }
|
|
| r really don't what to use really. Can someone give me some idea and also
| how will i be able to display it in
| my JSP using struts tags.
|
| thanks a lot.
|
| -Richard
|
| Visit our website at http://www.ubswarburg.com
|
| This message contains confidential information and is intended only
| for the individual named.  If you are not the named addressee you
| should not disseminate, distribute or copy this e-mail.  Please
| notify the sender immediately by e-mail if you have received this
| e-mail by mistake and delete this e-mail from your system.
|
| E-mail transmission cannot be guaranteed to be secure or error-free
| as information could be intercepted, corrupted, lost, destroyed,
| arrive late or incomplete, or contain viruses.  The sender therefore
| does not accept liability for any errors or omissions in the contents
| of this message which arise as a result of e-mail transmission.  If
| verification is required please request a hard-copy version.  This
| message is provided for informational purposes and should not be
| construed as a solicitation or offer to buy or sell any securities or
| related financial instruments.
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|
| Visit our website at http://www.ubswarburg.com
|
| This message contains confidential information and is intended only
| for the individual named.  If you are not the named addressee you
| should not disseminate, distribute or copy this e-mail.  Please
| notify the sender immediately by e-mail if you have received this
| e-mail by mistake and delete this e-mail from your system.
|
| E-mail transmission cannot be guaranteed to be secure or error-free
| as information could be intercepted, corrupted, lost, destroyed,
| arrive late or incomplete, or contain viruses.  The sender therefore
| does not accept liability for any errors or omissions in the contents
| of this message which arise as a result of e-mail transmission.  If
| verification is required please request a hard-copy version.  This
| message is provided for informational purposes and should not be
| construed as a solicitation or offer to buy or sell any securities or
| related financial instruments.
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


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