Re: Problems with iterate

2001-07-04 Thread suhas

That was supposed to be indexed iterator tag . Might not be in the struts -
official build

Suhas


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 04, 2001 9:37 AM
Subject: RE: Problems with iterate



Hi

There is according to documentation and TLD no attribute 'indexed' for the
html:text-tag in Struts 1.0. What version of Struts are you using?

Guido

|-+|
|Guido Roth   |SYSTOR AG   |
| ||
| ||
|   Tel. +41 1 405 35 12  |   Fax +41 1 405 31 13  |
| ||
| ||
|  [EMAIL PROTECTED]  |  Baslerstr. 60 |
| |   8048 Zürich  |
|-+|





Torsten Terp
   torsten@terps.   To:
[EMAIL PROTECTED]
   dk   cc:
 Subject:  RE: Problems with iterate

03.07.2001
 22:52
Please respond
to struts-user





Hi,

I did make your example work, thank you! However, i must admit, that if i
use struts and have to use jsp scriplet code, i think the idea is somehow
lost!
By using the index struts extension it is possible to make the same thing
work
like below. A little nicer i think

logic:iterate id=contacts name=form property=contactDataVector
html:hidden name=contacts property=contactId indexed=true/
  tr
td width=150
  html:text size=20 name=contacts property=contactFirstNames
indexed=true/
/td
td width=150
  html:text size=20 name=contacts property=contactLastName
indexed=true/
/td
  /tr
/logic:iterate

^terp

 -Original Message-
 From: Merikan Peter [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 02, 2001 9:20 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Problems with iterate


 Here is a working example of nested properties in an iterator.

 All I need is an indexed getter and setter for address in my testBean.(
getAddress(int index) )


 % String propertyValue = null;%
 logic:iterate id=address name=testBean property=addresses indexId
=addressIndex
 tr
   td valign=top
 Index #[bean:write name=addressIndex/]
   /td
   td
 table border=0
   tr
 thStreet:/th
 td
   % propertyValue = address[ + addressIndex + ].street; %
   html:text property=%=propertyValue%/
 /td
   /tr
   tr
 thZip Code:/th
 td
 % propertyValue = address[ + addressIndex + ].zipCode; %
   html:text property=%=propertyValue%/
 /td
   /tr
 /table
   /td
 /tr
 /logic:iterate

 /Peter



 -Original Message-
 From: Torsten Terp [mailto:[EMAIL PROTECTED]]
 Sent: den 1 juli 2001 20:01
 To: Struts user list
 Subject: Problems with iterate


 Hi,

 Sorry if this has been answered before, but i havent been able to find an
answer!

 Im using iterate to display a vector containg valueobjects, i.e.,

 html:form action=showContacts
 logic:iterate id=contacts name=form property=contactDataVector
 html:hidden name=contacts property=contactId/
 tr
   td width=150
 html:text name=contacts property=firstName size=20/
   /td
   td width=150
 html:text name=contacts property=lastName size=20/
   /td
 /tr
 ...
 ...

 'form' is my struts form bean, 'contactDataVector' is a vector of
'contactData'
 objects each containing (among others) the variables 'firstName' and
'lastName'.

 There is no problem in displaying the data, all goes well, but updating
fields
 in the form is not working, when i want to save the changes in the struts
action
 the vector is null! I can see that making a variable 'firstName' in the
form, results
 in a call to its setter method, i.e., i can make it work when updating a
single row,
 but i cant manage to get the update to work on the actual contactData
objects in the
 vector. ?!?!

 Any advices out there??

 ^terp












RE: Problems with iterate

2001-07-04 Thread Torsten Terp

Hi,

Im using the proposed index extension, made by Dave Hay.
It can be found on Ted Husted's site:
http://www.husted.com/about/struts/resources.htm#extensions - Indexed Tags


^terp

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 04, 2001 10:37 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Problems with iterate



 Hi

 There is according to documentation and TLD no attribute 'indexed' for the
 html:text-tag in Struts 1.0. What version of Struts are you using?

 Guido

 |-+|
 |Guido Roth   |SYSTOR AG   |
 | ||
 | ||
 |   Tel. +41 1 405 35 12  |   Fax +41 1 405 31 13  |
 | ||
 | ||
 |  [EMAIL PROTECTED]  |  Baslerstr. 60 |
 | |   8048 Zürich  |
 |-+|





 Torsten Terp
torsten@terps.   To:  [EMAIL PROTECTED]
dk   cc:
  Subject:  RE: Problems with iterate

 03.07.2001
  22:52
 Please respond
 to struts-user





 Hi,

 I did make your example work, thank you! However, i must admit, that if i
 use struts and have to use jsp scriplet code, i think the idea is somehow
 lost!
 By using the index struts extension it is possible to make the same thing
 work
 like below. A little nicer i think

 logic:iterate id=contacts name=form property=contactDataVector
 html:hidden name=contacts property=contactId indexed=true/
   tr
 td width=150
   html:text size=20 name=contacts property=contactFirstNames
 indexed=true/
 /td
 td width=150
   html:text size=20 name=contacts property=contactLastName
 indexed=true/
 /td
   /tr
 /logic:iterate

 ^terp

  -Original Message-
  From: Merikan Peter [mailto:[EMAIL PROTECTED]]
  Sent: Monday, July 02, 2001 9:20 AM
  To: '[EMAIL PROTECTED]'
  Subject: RE: Problems with iterate
 
 
  Here is a working example of nested properties in an iterator.
 
  All I need is an indexed getter and setter for address in my testBean.(
 getAddress(int index) )
 
 
  % String propertyValue = null;%
  logic:iterate id=address name=testBean property=addresses indexId
 =addressIndex
  tr
td valign=top
  Index #[bean:write name=addressIndex/]
/td
td
  table border=0
tr
  thStreet:/th
  td
% propertyValue = address[ + addressIndex + ].street; %
html:text property=%=propertyValue%/
  /td
/tr
tr
  thZip Code:/th
  td
  % propertyValue = address[ + addressIndex + ].zipCode; %
html:text property=%=propertyValue%/
  /td
/tr
  /table
/td
  /tr
  /logic:iterate
 
  /Peter
 
 
 
  -Original Message-
  From: Torsten Terp [mailto:[EMAIL PROTECTED]]
  Sent: den 1 juli 2001 20:01
  To: Struts user list
  Subject: Problems with iterate
 
 
  Hi,
 
  Sorry if this has been answered before, but i havent been able to find an
 answer!
 
  Im using iterate to display a vector containg valueobjects, i.e.,
 
  html:form action=showContacts
  logic:iterate id=contacts name=form property=contactDataVector
  html:hidden name=contacts property=contactId/
  tr
td width=150
  html:text name=contacts property=firstName size=20/
/td
td width=150
  html:text name=contacts property=lastName size=20/
/td
  /tr
  ...
  ...
 
  'form' is my struts form bean, 'contactDataVector' is a vector of
 'contactData'
  objects each containing (among others) the variables 'firstName' and
 'lastName'.
 
  There is no problem in displaying the data, all goes well, but updating
 fields
  in the form is not working, when i want to save the changes in the struts
 action
  the vector is null! I can see that making a variable 'firstName' in the
 form, results
  in a call to its setter method, i.e., i can make it work when updating a
 single row,
  but i cant manage to get the update to work on the actual contactData
 objects in the
  vector. ?!?!
 
  Any advices out there??
 
  ^terp
 
 














RE: Problems with iterate

2001-07-03 Thread Torsten Terp


Hi,

I did make your example work, thank you! However, i must admit, that if i 
use struts and have to use jsp scriplet code, i think the idea is somehow lost!
By using the index struts extension it is possible to make the same thing work
like below. A little nicer i think

logic:iterate id=contacts name=form property=contactDataVector
html:hidden name=contacts property=contactId indexed=true/
  tr
td width=150
  html:text size=20 name=contacts property=contactFirstNames 
indexed=true/
/td
td width=150
  html:text size=20 name=contacts property=contactLastName indexed=true/
/td
  /tr
/logic:iterate

^terp

 -Original Message-
 From: Merikan Peter [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 02, 2001 9:20 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Problems with iterate
 
 
 Here is a working example of nested properties in an iterator.
 
 All I need is an indexed getter and setter for address in my testBean.( 
getAddress(int index) ) 
 
 
 % String propertyValue = null;%
 logic:iterate id=address name=testBean property=addresses 
indexId=addressIndex
 tr
   td valign=top
 Index #[bean:write name=addressIndex/]
   /td
   td
 table border=0
   tr
 thStreet:/th
 td
   % propertyValue = address[ + addressIndex + ].street; % 
   html:text property=%=propertyValue%/
 /td  
   /tr 
   tr
 thZip Code:/th
 td
 % propertyValue = address[ + addressIndex + ].zipCode; % 
   html:text property=%=propertyValue%/
 /td  
   /tr 
 /table
   /td
 /tr
 /logic:iterate
 
 /Peter
 
  
 
 -Original Message-
 From: Torsten Terp [mailto:[EMAIL PROTECTED]]
 Sent: den 1 juli 2001 20:01
 To: Struts user list
 Subject: Problems with iterate
 
 
 Hi,
 
 Sorry if this has been answered before, but i havent been able to find an answer!
 
 Im using iterate to display a vector containg valueobjects, i.e., 
 
 html:form action=showContacts
 logic:iterate id=contacts name=form property=contactDataVector
 html:hidden name=contacts property=contactId/
 tr
   td width=150
 html:text name=contacts property=firstName size=20/
   /td
   td width=150
 html:text name=contacts property=lastName size=20/
   /td
 /tr
 ...
 ...
 
 'form' is my struts form bean, 'contactDataVector' is a vector of 'contactData'
 objects each containing (among others) the variables 'firstName' and 'lastName'.
 
 There is no problem in displaying the data, all goes well, but updating fields 
 in the form is not working, when i want to save the changes in the struts action 
 the vector is null! I can see that making a variable 'firstName' in the form, results
 in a call to its setter method, i.e., i can make it work when updating a single row, 
 but i cant manage to get the update to work on the actual contactData objects in the
 vector. ?!?!
 
 Any advices out there?? 
 
 ^terp
 
 




RE: Problems with iterate

2001-07-02 Thread Merikan Peter

Here is a working example of nested properties in an iterator.

All I need is an indexed getter and setter for address in my testBean.( getAddress(int 
index) ) 


% String propertyValue = null;%
logic:iterate id=address name=testBean property=addresses 
indexId=addressIndex
tr
  td valign=top
Index #[bean:write name=addressIndex/]
  /td
  td
table border=0
  tr
thStreet:/th
td
  % propertyValue = address[ + addressIndex + ].street; % 
  html:text property=%=propertyValue%/
/td  
  /tr 
  tr
thZip Code:/th
td
% propertyValue = address[ + addressIndex + ].zipCode; % 
  html:text property=%=propertyValue%/
/td  
  /tr 
/table
  /td
/tr
/logic:iterate

/Peter

 

-Original Message-
From: Torsten Terp [mailto:[EMAIL PROTECTED]]
Sent: den 1 juli 2001 20:01
To: Struts user list
Subject: Problems with iterate


Hi,

Sorry if this has been answered before, but i havent been able to find an answer!

Im using iterate to display a vector containg valueobjects, i.e., 

html:form action=showContacts
logic:iterate id=contacts name=form property=contactDataVector
html:hidden name=contacts property=contactId/
tr
  td width=150  
html:text name=contacts property=firstName size=20/
  /td
  td width=150
html:text name=contacts property=lastName size=20/
  /td
/tr
...
...

'form' is my struts form bean, 'contactDataVector' is a vector of 'contactData'
objects each containing (among others) the variables 'firstName' and 'lastName'.

There is no problem in displaying the data, all goes well, but updating fields 
in the form is not working, when i want to save the changes in the struts action 
the vector is null! I can see that making a variable 'firstName' in the form, results
in a call to its setter method, i.e., i can make it work when updating a single row, 
but i cant manage to get the update to work on the actual contactData objects in the
vector. ?!?!

Any advices out there?? 

^terp



RE: Problems with iterate

2001-07-02 Thread Torsten Terp

Hi,

Thanks for replying... I did stumble onto the index extension 
in my search, but i thought i could manage without! 

I will try to do as you describes, thanks a lot!

^terp

 -Original Message-
 From: Niall Pemberton [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 02, 2001 12:57 AM
 To: [EMAIL PROTECTED]
 Subject: RE: Problems with iterate
 
 
 You need to do two things.
 
 First, you need to generate appropriate names for your input fields. If you
 use the current Struts tags then all the occurances of your two fields in
 the example below will generate names of firstName and lastName. What
 you want is to generate names in the format contactDataVector[x].firstName
 and contactDataVector[x].lastName, where x is the index number of the
 field. Dave Hay has posted a set of modified Struts tags which generate
 these names on Ted Husted's site:
   http://www.husted.com/about/struts/resources.htm#extensions  - Indexed
 Tags
 
 Secondly you need to provide the appropriate getters/setters in your bean
 and ActionForm. Obviously in your bean you need setFirstName() and
 setLastName() methods - additionally you need the following getter in your
 ActionForm:
 
   public ContactData getContactDataVector(int index) {
 
  return (ContactData)(contactDataVector.get(index));
 
   }
 
 Hope this helps.
 
 
 Niall
 
 
 
  -Original Message-
  From: Torsten Terp [mailto:[EMAIL PROTECTED]]
  Sent: 01 July 2001 19:01
  To: Struts user list
  Subject: Problems with iterate
 
 
  Hi,
 
  Sorry if this has been answered before, but i havent been able to
  find an answer!
 
  Im using iterate to display a vector containg valueobjects, i.e.,
 
  html:form action=showContacts
  logic:iterate id=contacts name=form property=contactDataVector
  html:hidden name=contacts property=contactId/
  tr
td width=150
  html:text name=contacts property=firstName size=20/
/td
td width=150
  html:text name=contacts property=lastName size=20/
/td
  /tr
  ...
  ...
 
  'form' is my struts form bean, 'contactDataVector' is a vector of
  'contactData'
  objects each containing (among others) the variables 'firstName'
  and 'lastName'.
 
  There is no problem in displaying the data, all goes well, but
  updating fields
  in the form is not working, when i want to save the changes in
  the struts action
  the vector is null! I can see that making a variable 'firstName'
  in the form, results
  in a call to its setter method, i.e., i can make it work when
  updating a single row,
  but i cant manage to get the update to work on the actual
  contactData objects in the
  vector. ?!?!
 
  Any advices out there??
 
  ^terp
 
 
 
 




RE: Problems with iterate

2001-07-02 Thread Torsten Terp

Hi,

A giant thank you!!! There is nothing like source when in trouble :-)

Will try it at once

^terp

 -Original Message-
 From: Merikan Peter [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 02, 2001 9:20 AM
 To: '[EMAIL PROTECTED]'
 Subject: RE: Problems with iterate
 
 
 Here is a working example of nested properties in an iterator.
 
 All I need is an indexed getter and setter for address in my testBean.( 
getAddress(int index) ) 
 
 
 % String propertyValue = null;%
 logic:iterate id=address name=testBean property=addresses 
indexId=addressIndex
 tr
   td valign=top
 Index #[bean:write name=addressIndex/]
   /td
   td
 table border=0
   tr
 thStreet:/th
 td
   % propertyValue = address[ + addressIndex + ].street; % 
   html:text property=%=propertyValue%/
 /td  
   /tr 
   tr
 thZip Code:/th
 td
 % propertyValue = address[ + addressIndex + ].zipCode; % 
   html:text property=%=propertyValue%/
 /td  
   /tr 
 /table
   /td
 /tr
 /logic:iterate
 
 /Peter
 
  
 
 -Original Message-
 From: Torsten Terp [mailto:[EMAIL PROTECTED]]
 Sent: den 1 juli 2001 20:01
 To: Struts user list
 Subject: Problems with iterate
 
 
 Hi,
 
 Sorry if this has been answered before, but i havent been able to find an answer!
 
 Im using iterate to display a vector containg valueobjects, i.e., 
 
 html:form action=showContacts
 logic:iterate id=contacts name=form property=contactDataVector
 html:hidden name=contacts property=contactId/
 tr
   td width=150
 html:text name=contacts property=firstName size=20/
   /td
   td width=150
 html:text name=contacts property=lastName size=20/
   /td
 /tr
 ...
 ...
 
 'form' is my struts form bean, 'contactDataVector' is a vector of 'contactData'
 objects each containing (among others) the variables 'firstName' and 'lastName'.
 
 There is no problem in displaying the data, all goes well, but updating fields 
 in the form is not working, when i want to save the changes in the struts action 
 the vector is null! I can see that making a variable 'firstName' in the form, results
 in a call to its setter method, i.e., i can make it work when updating a single row, 
 but i cant manage to get the update to work on the actual contactData objects in the
 vector. ?!?!
 
 Any advices out there?? 
 
 ^terp
 
 




RE: Problems with iterate

2001-07-01 Thread Niall Pemberton

You need to do two things.

First, you need to generate appropriate names for your input fields. If you
use the current Struts tags then all the occurances of your two fields in
the example below will generate names of firstName and lastName. What
you want is to generate names in the format contactDataVector[x].firstName
and contactDataVector[x].lastName, where x is the index number of the
field. Dave Hay has posted a set of modified Struts tags which generate
these names on Ted Husted's site:
  http://www.husted.com/about/struts/resources.htm#extensions  - Indexed
Tags

Secondly you need to provide the appropriate getters/setters in your bean
and ActionForm. Obviously in your bean you need setFirstName() and
setLastName() methods - additionally you need the following getter in your
ActionForm:

  public ContactData getContactDataVector(int index) {

 return (ContactData)(contactDataVector.get(index));

  }

Hope this helps.


Niall



 -Original Message-
 From: Torsten Terp [mailto:[EMAIL PROTECTED]]
 Sent: 01 July 2001 19:01
 To: Struts user list
 Subject: Problems with iterate


 Hi,

 Sorry if this has been answered before, but i havent been able to
 find an answer!

 Im using iterate to display a vector containg valueobjects, i.e.,

 html:form action=showContacts
 logic:iterate id=contacts name=form property=contactDataVector
 html:hidden name=contacts property=contactId/
 tr
   td width=150
 html:text name=contacts property=firstName size=20/
   /td
   td width=150
 html:text name=contacts property=lastName size=20/
   /td
 /tr
 ...
 ...

 'form' is my struts form bean, 'contactDataVector' is a vector of
 'contactData'
 objects each containing (among others) the variables 'firstName'
 and 'lastName'.

 There is no problem in displaying the data, all goes well, but
 updating fields
 in the form is not working, when i want to save the changes in
 the struts action
 the vector is null! I can see that making a variable 'firstName'
 in the form, results
 in a call to its setter method, i.e., i can make it work when
 updating a single row,
 but i cant manage to get the update to work on the actual
 contactData objects in the
 vector. ?!?!

 Any advices out there??

 ^terp





Re: Problems with iterate

2001-07-01 Thread suhas

Let us see if I got this .

getFirstName ( ) and getLastName( ) should be in the ContactData class and
not needed in the ActionForm

And in the Form bean one should have only getContactDataVector(int index)
method as u said .

In reset() method of the ActionForm u can instantiate the ContactData class
and vector of ContactData class if it is null  .
So that in the jsp file u can have contactDataVector[i].firstName and
contactDataVector[i].lastName fields .
I think when u submit html:form then automatically ur FormBean's
contactDataVector will be intialized
1. by calling reset method first where u intialize the vector of contactData
. Then
2. by populating the ActionForm data ( contactDataVector) with the values
from form fields

Please correct me if I'm wrong .

Suhas




- Original Message -
From: Niall Pemberton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, July 01, 2001 11:56 PM
Subject: RE: Problems with iterate


 You need to do two things.

 First, you need to generate appropriate names for your input fields. If
you
 use the current Struts tags then all the occurances of your two fields in
 the example below will generate names of firstName and lastName. What
 you want is to generate names in the format
contactDataVector[x].firstName
 and contactDataVector[x].lastName, where x is the index number of the
 field. Dave Hay has posted a set of modified Struts tags which generate
 these names on Ted Husted's site:
   http://www.husted.com/about/struts/resources.htm#extensions  - Indexed
 Tags

 Secondly you need to provide the appropriate getters/setters in your bean
 and ActionForm. Obviously in your bean you need setFirstName() and
 setLastName() methods - additionally you need the following getter in your
 ActionForm:

   public ContactData getContactDataVector(int index) {

  return (ContactData)(contactDataVector.get(index));

   }

 Hope this helps.


 Niall



  -Original Message-
  From: Torsten Terp [mailto:[EMAIL PROTECTED]]
  Sent: 01 July 2001 19:01
  To: Struts user list
  Subject: Problems with iterate
 
 
  Hi,
 
  Sorry if this has been answered before, but i havent been able to
  find an answer!
 
  Im using iterate to display a vector containg valueobjects, i.e.,
 
  html:form action=showContacts
  logic:iterate id=contacts name=form property=contactDataVector
  html:hidden name=contacts property=contactId/
  tr
td width=150
  html:text name=contacts property=firstName size=20/
/td
td width=150
  html:text name=contacts property=lastName size=20/
/td
  /tr
  ...
  ...
 
  'form' is my struts form bean, 'contactDataVector' is a vector of
  'contactData'
  objects each containing (among others) the variables 'firstName'
  and 'lastName'.
 
  There is no problem in displaying the data, all goes well, but
  updating fields
  in the form is not working, when i want to save the changes in
  the struts action
  the vector is null! I can see that making a variable 'firstName'
  in the form, results
  in a call to its setter method, i.e., i can make it work when
  updating a single row,
  but i cant manage to get the update to work on the actual
  contactData objects in the
  vector. ?!?!
 
  Any advices out there??
 
  ^terp