Indexed Property

2004-03-22 Thread Prakasan OK
Hi,

can anyone give me a sample code for implementing indexed properties?
how should the jsp page and the corresponding Action class look like?

thanks,
Prakasan

RE: Indexed Property

2004-03-22 Thread Robert Taylor
http://jakarta.apache.org/struts/faqs/indexedprops.html

 -Original Message-
 From: Prakasan OK [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 22, 2004 6:18 AM
 To: Struts Users Mailing List
 Subject: Indexed Property
 
 
 Hi,
 
 can anyone give me a sample code for implementing indexed properties?
 how should the jsp page and the corresponding Action class look like?
 
 thanks,
 Prakasan

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



Re: Indexed Property

2004-03-22 Thread Mark Lowe
I don't know how helpful those examples are in reality as there are a 
few details missing..

So here's an example.

Personally i like nesting forms although this isn't to everyone's 
taste. The example uses LazyList to allow you to scope the form to 
request and the example was provided by Paul Chip on the list a few 
weeks back.

// action form

import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*;
import java.util.ArrayList;
import java.util.List;
import org.apache.struts.action.ActionForm;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.collections.Factory;
public class ItemsForm extends ActionForm {

private List itemList;
public ItemsForm() {
initLists();
}

private void initLists() {
Factory factory = new Factory() {
public Object create() {
return new ProductForm();
}
};
this.itemList = ListUtils.lazyList(new ArrayList(), factory);
}
public List getItems() {
return itemList;
}
public void setItems(List itemList) {
this.itemList = itemList;
}
public ItemForm getItem(int index) {
return (ItemForm) itemList.get(index);
}

public void setItem(int index,ItemForm item) {
this.itemList.add(index,item);
}
public void reset(ActionMapping mapping,
  HttpServletRequest request) {
super.reset(mapping, request);
initLists();
}
}
//ItemForm

public class ItemForm extends ActionForm {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
//ItemsAction [i'd use LookupDispatchAction]

ItemsForm theForm = (ItemsForm) form;

ItemForm item = new ItemForm();
item.setName(First Item);
ItemForm anotherItem = new ItemForm();
anotherItem.setName(Second Item);
theForm.setItem(0,item);
theForm.setItem(1,item);
// struts config

form-bean name=itemsForm type=ItemsForm /

action path=/populate name=itemsForm scope=request ...

action path=/save name=itemsForm scope=request..

//jsp

html:form path=/save.do
logic:iterate id=item name=itemsForm property=items
html:text name=item property=item indexed=true /
or

c:forEach var=item items=${itemsForm.items}
html:text name=item property=item indexed=true /
Sorry I didn't think about the potential confusing of using item 
quite so much.. But this should help close a few gaps.

On 22 Mar 2004, at 14:14, Robert Taylor wrote:

http://jakarta.apache.org/struts/faqs/indexedprops.html

-Original Message-
From: Prakasan OK [mailto:[EMAIL PROTECTED]
Sent: Monday, March 22, 2004 6:18 AM
To: Struts Users Mailing List
Subject: Indexed Property
Hi,

can anyone give me a sample code for implementing indexed properties?
how should the jsp page and the corresponding Action class look like?
thanks,
Prakasan
-
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]


Re: Indexed Property

2004-03-22 Thread Mark Lowe
correction
On 22 Mar 2004, at 14:42, Mark Lowe wrote:
I don't know how helpful those examples are in reality as there are a 
few details missing..

So here's an example.

Personally i like nesting forms although this isn't to everyone's 
taste. The example uses LazyList to allow you to scope the form to 
request and the example was provided by Paul Chip on the list a few 
weeks back.

// action form

import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*;
import java.util.ArrayList;
import java.util.List;
import org.apache.struts.action.ActionForm;
import org.apache.commons.collections.ListUtils;
import org.apache.commons.collections.Factory;
public class ItemsForm extends ActionForm {

private List itemList;
public ItemsForm() {
initLists();
}

private void initLists() {
Factory factory = new Factory() {
public Object create() {
		return new ItemForm();

return new ProductForm();
}
};
this.itemList = ListUtils.lazyList(new ArrayList(), factory);
}
public List getItems() {
return itemList;
}
public void setItems(List itemList) {
this.itemList = itemList;
}
public ItemForm getItem(int index) {
return (ItemForm) itemList.get(index);
}

public void setItem(int index,ItemForm item) {
this.itemList.add(index,item);
}
public void reset(ActionMapping mapping,
  HttpServletRequest request) {
super.reset(mapping, request);
initLists();
}
}
//ItemForm

public class ItemForm extends ActionForm {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
//ItemsAction [i'd use LookupDispatchAction]

ItemsForm theForm = (ItemsForm) form;

ItemForm item = new ItemForm();
item.setName(First Item);
ItemForm anotherItem = new ItemForm();
anotherItem.setName(Second Item);
theForm.setItem(0,item);
theForm.setItem(1,item);
// struts config

form-bean name=itemsForm type=ItemsForm /

action path=/populate name=itemsForm scope=request ...

action path=/save name=itemsForm scope=request..

//jsp

html:form path=/save.do
logic:iterate id=item name=itemsForm property=items
html:text name=item property=item indexed=true /
or

c:forEach var=item items=${itemsForm.items}
html:text name=item property=item indexed=true /
Sorry I didn't think about the potential confusing of using item 
quite so much.. But this should help close a few gaps.

On 22 Mar 2004, at 14:14, Robert Taylor wrote:

http://jakarta.apache.org/struts/faqs/indexedprops.html

-Original Message-
From: Prakasan OK [mailto:[EMAIL PROTECTED]
Sent: Monday, March 22, 2004 6:18 AM
To: Struts Users Mailing List
Subject: Indexed Property
Hi,

can anyone give me a sample code for implementing indexed properties?
how should the jsp page and the corresponding Action class look like?
thanks,
Prakasan
-
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]


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


indexed property problem

2004-03-18 Thread Axel Groß
Hi Mark!

thanks for your answer
 tdtestPrimKey[${ctr}]/td
evaluates to as it should to testPrimKey[0], testPrimKey[1]..
( i did a stupid mistake in my code ),

On 2004-03-18 at 13:25:22 +0100, Mark Lowe wrote:
 ${testPrimKey[ctr]}
that actually evaluates to nothing
but ${mappedTest.testPrimKey[ctr]}
gets the right result

BUT my original intention (to use it with html:struts) still fails, because
the tag doesnt populate the value for the indexed property:
without using the indexed property:
 html:text name=mappedTest property='testPrimKey'/html:text
- is as expected:
 input type=text name=testPrimKey value=[Ljava...{right object reference} /

with using the indexed property
 html:text name=mappedTest property='testPrimKey[${ctr}]' /
- doesnt put value attribute:
 input type=text name=testPrimKey[0] value= / 
 input type=text name=testPrimKey[1] value= / 
 ...

if anybody could help me with that one, i'd be relieved
thanks,
axel

 
 or perhaps with the wrappers
 
 c:set var=key value=${testPrimKey[ctr]} /
 ${key}
 
  what does that do?
 
 
 On 18 Mar 2004, at 12:46, Axel Groß wrote:
 
 hi all!
 
 while trying to figure out how indexed/mapped properties work I get 
 some strange
 behaviour - I'm pretty sure this doesn't conform to standard (hope I'm
 mistaken):
 logic:iterate id=foo indexId=ctr name=mappedTest 
 property=testPrimKey
   tr
 td${foo}/td
 td${ctr}/td
 tdtestPrimKey[${ctr}]/td
   /tr
 /logic:iterate
 
 evaluates to:
   tr
 tdk1/td
 td0/td
 tdtestPrimKey[]/td
   /tr
   tr
 tdk2/td
 td1/td
 tdtestPrimKey[]/td
   /tr
   ...
 
 where the k1, k2.. are the expected values of key testPrimKey in the
 HashMap put under mappedTest in the PageContext
 BUT ${ctr} gets evaluated to different values
 
 I'm using struts1.1 and tomcat 5.0.19
 so whose wrong?
 me or the result ???
 
 thanks for enlightenment!
 Axel
 
 -
 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]
 
 

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



Re: indexed property problem

2004-03-18 Thread Mark Lowe
try

 html-el:text name=mappedTest property=testPrimKey(${ctr}) /



On 18 Mar 2004, at 14:49, Axel Groß wrote:

Hi Mark!

thanks for your answer
   tdtestPrimKey[${ctr}]/td
evaluates to as it should to testPrimKey[0], testPrimKey[1]..
( i did a stupid mistake in my code ),
On 2004-03-18 at 13:25:22 +0100, Mark Lowe wrote:
${testPrimKey[ctr]}
that actually evaluates to nothing
but ${mappedTest.testPrimKey[ctr]}
gets the right result
BUT my original intention (to use it with html:struts) still fails, 
because
the tag doesnt populate the value for the indexed property:
without using the indexed property:
 html:text name=mappedTest property='testPrimKey'/html:text
- is as expected:
 input type=text name=testPrimKey value=[Ljava...{right object 
reference} /

with using the indexed property
 html:text name=mappedTest property='testPrimKey[${ctr}]' /
- doesnt put value attribute:
 input type=text name=testPrimKey[0] value= /
 input type=text name=testPrimKey[1] value= /
 ...
if anybody could help me with that one, i'd be relieved
thanks,
axel
or perhaps with the wrappers

c:set var=key value=${testPrimKey[ctr]} /
${key}
 what does that do?

On 18 Mar 2004, at 12:46, Axel Groß wrote:

hi all!

while trying to figure out how indexed/mapped properties work I get
some strange
behaviour - I'm pretty sure this doesn't conform to standard (hope 
I'm
mistaken):
logic:iterate id=foo indexId=ctr name=mappedTest
property=testPrimKey
 tr
   td${foo}/td
   td${ctr}/td
   tdtestPrimKey[${ctr}]/td
 /tr
/logic:iterate

evaluates to:
 tr
   tdk1/td
   td0/td
   tdtestPrimKey[]/td
 /tr
 tr
   tdk2/td
   td1/td
   tdtestPrimKey[]/td
 /tr
 ...
where the k1, k2.. are the expected values of key testPrimKey in 
the
HashMap put under mappedTest in the PageContext
BUT ${ctr} gets evaluated to different values

I'm using struts1.1 and tomcat 5.0.19
so whose wrong?
me or the result ???
thanks for enlightenment!
Axel
-
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]

-
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]


Re: indexed property problem

2004-03-18 Thread Axel Groß
On 2004-03-18 at 15:10:47 +0100, Mark Lowe wrote:
 try
 
  html-el:text name=mappedTest property=testPrimKey(${ctr}) /
doesnt exist in struts 1.1,right?
should be evaluated anyway...
i tried now
 html:text name=mappedTest property='testPrimKey[0]' /
- still
 input type=text name=testPrimKey[0] value= /
 
should that version work? if so it doesnt seem to be the EL part which is
amiss.

 
 
 
 
 On 18 Mar 2004, at 14:49, Axel Groß wrote:
 
 Hi Mark!
 
 thanks for your answer
tdtestPrimKey[${ctr}]/td
 evaluates to as it should to testPrimKey[0], testPrimKey[1]..
 ( i did a stupid mistake in my code ),
 
 On 2004-03-18 at 13:25:22 +0100, Mark Lowe wrote:
 ${testPrimKey[ctr]}
 that actually evaluates to nothing
 but ${mappedTest.testPrimKey[ctr]}
 gets the right result
 
 BUT my original intention (to use it with html:struts) still fails, 
 because
 the tag doesnt populate the value for the indexed property:
 without using the indexed property:
  html:text name=mappedTest property='testPrimKey'/html:text
 - is as expected:
  input type=text name=testPrimKey value=[Ljava...{right object 
 reference} /
 
 with using the indexed property
  html:text name=mappedTest property='testPrimKey[${ctr}]' /
 - doesnt put value attribute:
  input type=text name=testPrimKey[0] value= /
  input type=text name=testPrimKey[1] value= /
  ...
 
 if anybody could help me with that one, i'd be relieved
 thanks,
 axel
 
 
 or perhaps with the wrappers
 
 c:set var=key value=${testPrimKey[ctr]} /
 ${key}
 
  what does that do?
 
 
 On 18 Mar 2004, at 12:46, Axel Groß wrote:
 
 hi all!
 
 while trying to figure out how indexed/mapped properties work I get
 some strange
 behaviour - I'm pretty sure this doesn't conform to standard (hope 
 I'm
 mistaken):
 logic:iterate id=foo indexId=ctr name=mappedTest
 property=testPrimKey
  tr
td${foo}/td
td${ctr}/td
tdtestPrimKey[${ctr}]/td
  /tr
 /logic:iterate
 
 evaluates to:
  tr
tdk1/td
td0/td
tdtestPrimKey[]/td
  /tr
  tr
tdk2/td
td1/td
tdtestPrimKey[]/td
  /tr
  ...
 
 where the k1, k2.. are the expected values of key testPrimKey in 
 the
 HashMap put under mappedTest in the PageContext
 BUT ${ctr} gets evaluated to different values
 
 I'm using struts1.1 and tomcat 5.0.19
 so whose wrong?
 me or the result ???
 
 thanks for enlightenment!
 Axel
 
 -
 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]
 
 
 
 -
 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]
 
 

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



Re: indexed property problem

2004-03-18 Thread Mark Lowe
I thought you were trying to get a mapped property.

What does the structure look like? I cant see what you're drilling to.

On 18 Mar 2004, at 15:23, Axel Groß wrote:

On 2004-03-18 at 15:10:47 +0100, Mark Lowe wrote:
try

 html-el:text name=mappedTest property=testPrimKey(${ctr}) /
doesnt exist in struts 1.1,right?
should be evaluated anyway...
i tried now
 html:text name=mappedTest property='testPrimKey[0]' /
- still
 input type=text name=testPrimKey[0] value= /
should that version work? if so it doesnt seem to be the EL part which  
is
amiss.





On 18 Mar 2004, at 14:49, Axel Groß wrote:

Hi Mark!

thanks for your answer
  tdtestPrimKey[${ctr}]/td
evaluates to as it should to testPrimKey[0], testPrimKey[1]..
( i did a stupid mistake in my code ),
On 2004-03-18 at 13:25:22 +0100, Mark Lowe wrote:
${testPrimKey[ctr]}
that actually evaluates to nothing
but ${mappedTest.testPrimKey[ctr]}
gets the right result
BUT my original intention (to use it with html:struts) still fails,
because
the tag doesnt populate the value for the indexed property:
without using the indexed property:
html:text name=mappedTest property='testPrimKey'/html:text
- is as expected:
input type=text name=testPrimKey value=[Ljava...{right object
reference} /
with using the indexed property
html:text name=mappedTest property='testPrimKey[${ctr}]' /
- doesnt put value attribute:
input type=text name=testPrimKey[0] value= /
input type=text name=testPrimKey[1] value= /
...
if anybody could help me with that one, i'd be relieved
thanks,
axel
or perhaps with the wrappers

c:set var=key value=${testPrimKey[ctr]} /
${key}
what does that do?

On 18 Mar 2004, at 12:46, Axel Groß wrote:

hi all!

while trying to figure out how indexed/mapped properties work I get
some strange
behaviour - I'm pretty sure this doesn't conform to standard (hope
I'm
mistaken):
logic:iterate id=foo indexId=ctr name=mappedTest
property=testPrimKey
tr
  td${foo}/td
  td${ctr}/td
  tdtestPrimKey[${ctr}]/td
/tr
/logic:iterate
evaluates to:
tr
  tdk1/td
  td0/td
  tdtestPrimKey[]/td
/tr
tr
  tdk2/td
  td1/td
  tdtestPrimKey[]/td
/tr
...
where the k1, k2.. are the expected values of key testPrimKey in
the
HashMap put under mappedTest in the PageContext
BUT ${ctr} gets evaluated to different values
I'm using struts1.1 and tomcat 5.0.19
so whose wrong?
me or the result ???
thanks for enlightenment!
Axel
--- 
--
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]


-
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]

-
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]


Re: indexed property problem

2004-03-18 Thread Axel Groß
i was trying to figure out how to use indexed properties.
in the end I want to pass a collection of name/value pairs to the form,
which the user can edit and then check those and maybe pass the new values
to business logic.
at the moment i'm trying to do this with two String[], one called keys the
other one called values.
For passing those values to the browser, I try using indexed propertie.
As I'm not sure how it has to look like in html so that struts will
populate the ActionForm I'm stuck with the html:text tag, which I can't 
make work the way I'd like it to

testPrimKey is a String[] which should put values into the html,
which should get put into the ActionForm, which has an indexed 
property called 'keys'
so if I'm guessing right it should look in the end like
 input type=text value=k1 name=keys[0] /
but if I have that i get a 

ServletException: BeanUtils.populate
..(RequestUtils.java:1254)
root cause
 ArrayIndexOutOfBoundsException
   java.lang.reflect.Aray.set(Native Method)

...
so maybe that means, the html syntax is ok; but i don't know..
:/

On 2004-03-18 at 17:17:10 +0100, Mark Lowe wrote:
 I thought you were trying to get a mapped property.
 
 What does the structure look like? I cant see what you're drilling to.
 
 
 On 18 Mar 2004, at 15:23, Axel Groß wrote:
 
 On 2004-03-18 at 15:10:47 +0100, Mark Lowe wrote:
 try
 
  html-el:text name=mappedTest property=testPrimKey(${ctr}) /
 doesnt exist in struts 1.1,right?
 should be evaluated anyway...
 i tried now
  html:text name=mappedTest property='testPrimKey[0]' /
 - still
  input type=text name=testPrimKey[0] value= /
 
 should that version work? if so it doesnt seem to be the EL part which  
 is
 amiss.
 
 
 
 
 
 On 18 Mar 2004, at 14:49, Axel Groß wrote:
 
 Hi Mark!
 
 thanks for your answer
   tdtestPrimKey[${ctr}]/td
 evaluates to as it should to testPrimKey[0], testPrimKey[1]..
 ( i did a stupid mistake in my code ),
 
 On 2004-03-18 at 13:25:22 +0100, Mark Lowe wrote:
 ${testPrimKey[ctr]}
 that actually evaluates to nothing
 but ${mappedTest.testPrimKey[ctr]}
 gets the right result
 
 BUT my original intention (to use it with html:struts) still fails,
 because
 the tag doesnt populate the value for the indexed property:
 without using the indexed property:
 html:text name=mappedTest property='testPrimKey'/html:text
 - is as expected:
 input type=text name=testPrimKey value=[Ljava...{right object
 reference} /
 
 with using the indexed property
 html:text name=mappedTest property='testPrimKey[${ctr}]' /
 - doesnt put value attribute:
 input type=text name=testPrimKey[0] value= /
 input type=text name=testPrimKey[1] value= /
 ...
 
 if anybody could help me with that one, i'd be relieved
 thanks,
 axel
 
 
 or perhaps with the wrappers
 
 c:set var=key value=${testPrimKey[ctr]} /
 ${key}
 
 what does that do?
 
 
 On 18 Mar 2004, at 12:46, Axel Groß wrote:
 
 hi all!
 
 while trying to figure out how indexed/mapped properties work I get
 some strange
 behaviour - I'm pretty sure this doesn't conform to standard (hope
 I'm
 mistaken):
 logic:iterate id=foo indexId=ctr name=mappedTest
 property=testPrimKey
 tr
   td${foo}/td
   td${ctr}/td
   tdtestPrimKey[${ctr}]/td
 /tr
 /logic:iterate
 
 evaluates to:
 tr
   tdk1/td
   td0/td
   tdtestPrimKey[]/td
 /tr
 tr
   tdk2/td
   td1/td
   tdtestPrimKey[]/td
 /tr
 ...
 
 where the k1, k2.. are the expected values of key testPrimKey in
 the
 HashMap put under mappedTest in the PageContext
 BUT ${ctr} gets evaluated to different values
 
 I'm using struts1.1 and tomcat 5.0.19
 so whose wrong?
 me or the result ???
 
 thanks for enlightenment!
 Axel
 
 --- 
 --
 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]
 
 
 
 -
 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]
 
 
 
 -
 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]
 
 

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



Re: indexed property problem

2004-03-18 Thread Axel Groß
went through the beanutils code to find the reason for the
ArrayIndexOutOfBounds.
found that it doesn't use my setter method, which would adjust the array
size, but just my getter method (which returns an array, which isn't big
enough); moving over to lists instead

so i suppose my html was correct.
the html:text issues are still not working anyway :/

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



Re: Nested Indexed Property Question

2004-02-19 Thread Mark Lowe
What about indexed=true on the radio button?

On 19 Feb 2004, at 04:36, Johnson, Gary wrote:

Hello *,
I've been trying to generate a variable list of text fields with 
each
row containing a radio button and 2 text fields. The getters seem to 
work
OK, but can't seem to make the setters work. I've read the FAQ, 
searched the
mailing lists, and scoured the web looking for clues as to why the 
page data
isn't being set in my form class from the request object. Any help 
would be
greatly appreciated.TIA, Gary

This JSP snippet

logic:iterate id=agencyInfo
 name=adminAgencyFileSetupForm
 property=agencyFileInfo
  indexId=index
 type=AdminAgencyFileSetupForm
tr
tdhtml:radio name=agencyInfo property=optionSelected
idName=agencyInfo value=agencyId//td
tdhtml:text  name=agencyInfo property=fileDirectory
indexed=true//td
tdhtml:text  name=agencyInfo property=pollingInterval
indexed=true//td
/tr
/logic:iterate
Generates this HTML

tr
tdinput type=radio name=optionSelected value=1/td
tdinput type=text  name=agencyInfo[0].fileDirectory   
value=File
Directory 0/td
tdinput type=text  name=agencyInfo[0].pollingInterval
value=1/td
/tr

tr
tdinput type=radio name=optionSelected value=3/td
tdinput type=text  name=agencyInfo[1].fileDirectory   
value=File
Directory 1/td
tdinput type=text  name=agencyInfo[1].pollingInterval
value=1/td
/tr

Which I believe is correct. The getAgencyFileInfo method is returning 
an
ArrayList of AdminAgencyFileSetupForm objects and struts is correctly
retrieving fileDirectory and pollingInterval values. If I'm reading the
Indexed property FAQ correctly struts should call getAgencyInfo(int 
index)
to first retrieve the correct AdminAgencyFileSetupForm object and then 
call
setFileDirectory(page_field_data) and
setPollingInterval(page_field_data).

After changing 1 set of fields on the page the log shows:

, agencyInfo[1].pollingInterval, [1567])
2004-02-18 21:33:53,088  -  Entering getAgencyInfo(1)
2004-02-18 21:33:53,088  - Target bean =
optionSelected = 'null'
action = 'null'
saveBtn= 'null'
agencyId   = '3'
fileDir= 'File Directory 1'
pollIntvl  = '1'
2004-02-18 21:33:53,088  - Target name = pollingInterval
2004-02-18 21:33:53,088  - Skipping read-only property
2004-02-18 21:33:53,088  -   setProperty(
optionSelected = 'null'
action = 'null'
saveBtn= 'null'
agencyId   = 'null'
fileDir= 'null'
pollIntvl  = 'null'
So, getAgencyInfo(index) is being called, but struts can't seem to 
find the
setPollingInterval(String) method (and it is defined), assumes it is
read-only and skips. I've tried every permutation for defining the 
iterate
and text options and methods and nothing seems to work. Would a more
experienced struts developer be so kind as to let me know what the heck
might be wrong here?..Again, TIA, Gary


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


RE: Nested Indexed Property Question

2004-02-19 Thread Johnson, Gary
Although not shown below, the value of the radio button is set in the action
form OK. It's the indexed properties that are causing the grief.

-Original Message-
From: Mark Lowe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 19, 2004 3:32 AM
To: Struts Users Mailing List
Subject: Re: Nested Indexed Property Question



What about indexed=true on the radio button?

On 19 Feb 2004, at 04:36, Johnson, Gary wrote:

 Hello *,
 I've been trying to generate a variable list of text fields with
 each
 row containing a radio button and 2 text fields. The getters seem to 
 work
 OK, but can't seem to make the setters work. I've read the FAQ, 
 searched the
 mailing lists, and scoured the web looking for clues as to why the 
 page data
 isn't being set in my form class from the request object. Any help 
 would be
 greatly appreciated.TIA, Gary

 This JSP snippet

 logic:iterate id=agencyInfo
  name=adminAgencyFileSetupForm
  property=agencyFileInfo
   indexId=index
  type=AdminAgencyFileSetupForm
 tr
 tdhtml:radio name=agencyInfo property=optionSelected 
 idName=agencyInfo value=agencyId//td
 tdhtml:text  name=agencyInfo property=fileDirectory 
 indexed=true//td
 tdhtml:text  name=agencyInfo property=pollingInterval 
 indexed=true//td
 /tr
 /logic:iterate


 Generates this HTML

 tr
 tdinput type=radio name=optionSelected value=1/td

 tdinput type=text  name=agencyInfo[0].fileDirectory   
 value=File
 Directory 0/td
 tdinput type=text  name=agencyInfo[0].pollingInterval
 value=1/td
 /tr

 tr
 tdinput type=radio name=optionSelected value=3/td

 tdinput type=text  name=agencyInfo[1].fileDirectory   
 value=File
 Directory 1/td
 tdinput type=text  name=agencyInfo[1].pollingInterval
 value=1/td
 /tr

 Which I believe is correct. The getAgencyFileInfo method is returning
 an
 ArrayList of AdminAgencyFileSetupForm objects and struts is correctly
 retrieving fileDirectory and pollingInterval values. If I'm reading the
 Indexed property FAQ correctly struts should call getAgencyInfo(int 
 index)
 to first retrieve the correct AdminAgencyFileSetupForm object and then 
 call
 setFileDirectory(page_field_data) and
 setPollingInterval(page_field_data).

 After changing 1 set of fields on the page the log shows:

 , agencyInfo[1].pollingInterval, [1567])
 2004-02-18 21:33:53,088  -  Entering getAgencyInfo(1)
 2004-02-18 21:33:53,088  - Target bean =
   optionSelected = 'null'
   action = 'null'
   saveBtn= 'null'
   agencyId   = '3'
   fileDir= 'File Directory 1'
   pollIntvl  = '1'

 2004-02-18 21:33:53,088  - Target name = pollingInterval
 2004-02-18 21:33:53,088  - Skipping read-only property
 2004-02-18 21:33:53,088  -   setProperty(
   optionSelected = 'null'
   action = 'null'
   saveBtn= 'null'
   agencyId   = 'null'
   fileDir= 'null'
   pollIntvl  = 'null'

 So, getAgencyInfo(index) is being called, but struts can't seem to
 find the
 setPollingInterval(String) method (and it is defined), assumes it is
 read-only and skips. I've tried every permutation for defining the 
 iterate
 and text options and methods and nothing seems to work. Would a more
 experienced struts developer be so kind as to let me know what the heck
 might be wrong here?..Again, TIA, Gary


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


Nested Indexed Property Question

2004-02-18 Thread Johnson, Gary
Hello *,
I've been trying to generate a variable list of text fields with each
row containing a radio button and 2 text fields. The getters seem to work
OK, but can't seem to make the setters work. I've read the FAQ, searched the
mailing lists, and scoured the web looking for clues as to why the page data
isn't being set in my form class from the request object. Any help would be
greatly appreciated.TIA, Gary

This JSP snippet

logic:iterate id=agencyInfo
 name=adminAgencyFileSetupForm
 property=agencyFileInfo
  indexId=index
 type=AdminAgencyFileSetupForm
tr
tdhtml:radio name=agencyInfo property=optionSelected
idName=agencyInfo value=agencyId//td
tdhtml:text  name=agencyInfo property=fileDirectory
indexed=true//td
tdhtml:text  name=agencyInfo property=pollingInterval
indexed=true//td
/tr
/logic:iterate


Generates this HTML

tr
tdinput type=radio name=optionSelected value=1/td

tdinput type=text  name=agencyInfo[0].fileDirectory   value=File
Directory 0/td
tdinput type=text  name=agencyInfo[0].pollingInterval
value=1/td
/tr

tr
tdinput type=radio name=optionSelected value=3/td

tdinput type=text  name=agencyInfo[1].fileDirectory   value=File
Directory 1/td
tdinput type=text  name=agencyInfo[1].pollingInterval
value=1/td
/tr

Which I believe is correct. The getAgencyFileInfo method is returning an
ArrayList of AdminAgencyFileSetupForm objects and struts is correctly
retrieving fileDirectory and pollingInterval values. If I'm reading the
Indexed property FAQ correctly struts should call getAgencyInfo(int index)
to first retrieve the correct AdminAgencyFileSetupForm object and then call
setFileDirectory(page_field_data) and
setPollingInterval(page_field_data).

After changing 1 set of fields on the page the log shows:

, agencyInfo[1].pollingInterval, [1567])
2004-02-18 21:33:53,088  -  Entering getAgencyInfo(1)
2004-02-18 21:33:53,088  - Target bean = 
optionSelected = 'null'
action = 'null'
saveBtn= 'null'
agencyId   = '3'
fileDir= 'File Directory 1'
pollIntvl  = '1'

2004-02-18 21:33:53,088  - Target name = pollingInterval
2004-02-18 21:33:53,088  - Skipping read-only property
2004-02-18 21:33:53,088  -   setProperty(
optionSelected = 'null'
action = 'null'
saveBtn= 'null'
agencyId   = 'null'
fileDir= 'null'
pollIntvl  = 'null'

So, getAgencyInfo(index) is being called, but struts can't seem to find the
setPollingInterval(String) method (and it is defined), assumes it is
read-only and skips. I've tried every permutation for defining the iterate
and text options and methods and nothing seems to work. Would a more
experienced struts developer be so kind as to let me know what the heck
might be wrong here?..Again, TIA, Gary


validate indexed property with DynaValidatorActionForm

2004-02-10 Thread Nathan Maves
Can this be done?

I have an Array of my customer objects as the indexed property.

Nathan Maves
Sun Microsystems

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

Re: Indexed Property in JSP

2004-01-30 Thread Sandy Bingham-Porter
Hello,

We are trying to implement common master-detail records using indexed
properties and beans.
We would like take a single bean with various data and place in a
dynaform bean as multiple occurrences.
The single bean was created with all the getters and setters.  And the
dynaform bean was created as followed:
form-bean name=transtudent
type=org.apache.struts.action.DynaActionForm
  form-property name = lines type=SPermitForm[] size=4 /
Our Jsp page tries to retrieve the 4 lines within transtudent and cannot
find a setter for 'ssn'.  This happens to be one of many fields within 
the single bean and this setter/getter is coded and been used.The 
error we get is No getter method for property ssn in bean lines  The 
Jsp follows:

html:form action=reviewPurchases.do
c:forEach var=lines varStatus=status
   items=${transtudent.map.lines}
   c:out value=${status.index +1}/
   html:text indexed=true name=lines property=ssn/
/c:forEach
/html:form
Can anyone give us some insight as to why we are getting this error message?

Many thanks,

Sandy Bingham-Porter
Eastern Illinois University




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


best way to handle an indexed property and a textarea

2004-01-29 Thread Arne Brutschy
Hi all,

I want to use an indexed property with a textarea. Line 0 in the 
textarea should be array[0] etc. What is the best way to do this? Right 
now, I'm thinking about writing a custom tag, subclassing TextareaTag 
and splitting up the data something like value.split(\\r\\n);
Is there a more simple way?

Regards,
Arne Brutschy


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


RE: best way to handle an indexed property and a textarea

2004-01-29 Thread Guillermo Meyer
I needed this feature in one place of my application and made it but
didn´t subclass TextAreaTag, neither created a custom tag (thought i
should). In fact, now that I see it, it's a little messy :P. I know it
can be done better, but it's just only as an idea of what i did and a
starting point for you to solve this problem:


%@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/tld/x71taglib.tld prefix=x71 %

%
String maxLength = 78; //max lenght of each row
String size = 145; //size of each row
int max = 10; //number of rows
%

style
.editMsg { BORDER-BOTTOM: #104a7b 1px solid; BORDER-LEFT: #afc4d5 1px
solid; BORDER-RIGHT: #104a7b 1px solid; BORDER-TOP: #afc4d5 1px solid;
COLOR: #00; CURSOR: none; FONT-FAMILY: tahoma,sans-serif; FONT-SIZE:
11px; HEIGHT: 19px; TEXT-DECORATION: none}
/style
%-- you could use logic:iterate --%
% for(int i=0;imax;i++) { %
brinput type=text name=textoMensaje size=%=size%
maxlength=%=maxLength% class=editMsg
onkeypress=inputKeyPress(%=i%, this, event);
% } %

%-- this is the property that replaces the textarea
--%
html:hidden property=elemento.adenda.MCStexto/
script
!--
//detects keypressed on each row
function inputKeyPress(index, input, e) {
var whichASCCan = (document.all?e.keyCode:e.which);
if((whichASCCan==13 || input.value.length == %=maxLength%) 
index  %=max - 1%) {
document.forms['0'].textoMensaje[index+1].focus();
}
}

//load text and splits in each row
function loadText() {
var textoCompleto =
document.forms[0].elements['elemento.adenda.MCStexto'].value;
var ind = 0;
var k2 = 0;
var strAux = ;
for(k=0;ktextoCompleto.length;k++) {
strAux+=textoCompleto.charAt(k);
k2++;
if(k2=%=maxLength%) {

document.forms[0].textoMensaje[ind].value=trim(strAux);
strAux = ;
ind++;
k2=0;
}
}
if(ind  %=max%)
document.forms[0].textoMensaje[ind].value=strAux;
}

//collects all rows and append the result in the hidden value.
function saveText() {
var textoCompleto =
document.forms[0].elements['elemento.adenda.MCStexto'];
textoCompleto.value = ;
for(k=0;k  %=max%;k++) {

textoCompleto.value+=padd(document.forms[0].textoMensaje[k].value,
%=maxLength%, ' ');
}
return true;
}

//it could be placed onload of body
loadText();
//--
/script

Cheers
Guillermo.

-Original Message-
From: Arne Brutschy [mailto:[EMAIL PROTECTED] 
Sent: Jueves, 29 de Enero de 2004 07:10 a.m.
To: Struts Users Mailing List
Subject: best way to handle an indexed property and a textarea


Hi all,

I want to use an indexed property with a textarea. Line 0 in the 
textarea should be array[0] etc. What is the best way to do this? Right 
now, I'm thinking about writing a custom tag, subclassing TextareaTag 
and splitting up the data something like value.split(\\r\\n); Is there
a more simple way?

Regards,
Arne Brutschy



-
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]



AUTO {ICICICARE#005-214-866}best way to handle an indexed property and a textarea

2004-01-29 Thread NRI Cell
Dear Sir / Madam,Thank you for writing to [EMAIL PROTECTED] We confirm receipt of your 
mail and assure you of a response shortly.To help us serve you better, we would 
request you to kindly mention your account number or any reference number you may have 
in your future correspondence.  Kindly visit our website www.icicibank.com\nri to know 
more on our products and services.  With regards,Customer Care 
ICICI Bank Limited This communication being sent by ICICI Bank Ltd. is privileged and 
confidential, and is directed to and for the use of the addressee only. If this 
message reaches anyone other than the intended recipient, we request the reader not to 
reproduce, copy, disseminate or in any manner distribute it. We further request such 
recipient to notify us immediately by return email and delete the original message. 
ICICI Bank Ltd. does not guarantee the security of any information transmitted 
electronically and is not liable for the proper, timely and complete transmission 
thereof. Before opening any attachments please check them for viruses and defects.



AUTO {ICICICARE#005-220-655}best way to handle an indexed property and a textarea

2004-01-29 Thread NRI Cell
Dear Sir / Madam,Thank you for writing to [EMAIL PROTECTED] We confirm receipt of your 
mail and assure you of a response shortly.To help us serve you better, we would 
request you to kindly mention your account number or any reference number you may have 
in your future correspondence.  Kindly visit our website www.icicibank.com\nri to know 
more on our products and services.  With regards,Customer Care 
ICICI Bank Limited This communication being sent by ICICI Bank Ltd. is privileged and 
confidential, and is directed to and for the use of the addressee only. If this 
message reaches anyone other than the intended recipient, we request the reader not to 
reproduce, copy, disseminate or in any manner distribute it. We further request such 
recipient to notify us immediately by return email and delete the original message. 
ICICI Bank Ltd. does not guarantee the security of any information transmitted 
electronically and is not liable for the proper, timely and complete transmission 
thereof. Before opening any attachments please check them for viruses and defects.



Re: populate indexed property : skipping read-only property - SOLVED

2004-01-11 Thread Pierre Henry
Pierre Henry wrote:

Hi all,

I am trying to use an indexed property following the howto 
(http://www.apache.org/~sraeburn/maven/faqs/indexedprops.html). I also 
read many many related mails on this list, but... :(

I have no problem with the getters, but unfortunately, I can not make 
it work to set the values of the indexed property.

The property is a simple String. The number of  them is completely 
dynamic.

The output of tomcat seems to indicate that the BeanUtils.populate 
does not see my indexed setter. Here is the output :
...
[DEBUG] RequestProcessor - - Populating bean properties from this request
[DEBUG] BeanUtils - 
-BeanUtils.populate([EMAIL PROTECTED]
f62, {customerCategoryId[2]=[Ljava.lang.String;@1703484, 
customerPhone=[Ljava.la
ng.String;@187e184, customerCategoryId[0]=[Ljava.lang.String;@1e6cf07, 
customerL
astName=[Ljava.lang.String;@2209db, 
customerFirstName=[Ljava.lang.String;@b53b32
, customerAddress=[Ljava.lang.String;@41647f, 
customerCategoryId[1]=[Ljava.lang.
String;@12cd736, customerEmail=[Ljava.lang.String;@e51bda})
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] RequestProcessor - - Validating input form properties
[DEBUG] RequestProcessor - - Looking for Action instance for class 
singha.actions.ReservationStep3Action
...

Here is a snippet of my ReservationStep3Form FormBean :
 private ArrayList customerCategoryIds = new ArrayList();
 public void reset(ActionMapping mapping,
 HttpServletRequest request)
   {
 ...
 customerCategoryIds = new ArrayList();
   }
   public String getCustomerCategoryId(int index){
 System.out.println(getCustomerCategoryId);
 if(index  customerCategoryIds.size()) return 
(String)customerCategoryIds.get(index);
 return null;
   }
 public void setCustomerCategroryId(int index, String value){
 if(index = customerCategoryIds.size()) 
customerCategoryIds.ensureCapacity(index+1);
 customerCategoryIds.set(index,  value);
   }

Here is the relevant part of the JSP :
I have a list of positions object from the action. I want to add some 
info to these positons, and in the same form get some infos about the 
customer (name...).

html:form action=reservationStep3
logic:iterate id=position name=positions indexId=index
   html:select property='%= customerCategoryId[ + index + ] %' 
logic:iterate id=price name=position property=value
  html:option value=price.customerCategoryId 
style=text-align:right
  bean:write name=price 
property=customerCategory.name / -
  bean:write name=price property=formattedValue/
  /html:option
/logic:iterate   /html:select
/logic:iterate
//other fields (customer name, address etc...)

This JSP generates the right html like :

select name=customerCategoryId[0] 
option value=123 Normal - $14.00/option
...
/select
DO I have to add something to struts-config ? Or what do I have to do, 
what do I do wrong  ? Any help is really welcome !

Pierre Henry



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

Sorry every body. The problem was only that I wrote 
setCustomerCategroryId  instead of category... and was too tired to even 
notice that...

Sorry, I hope nobody spent time on this...

Pierre Henry

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


populate indexed property : skipping read-only property

2004-01-10 Thread Pierre Henry
Hi all,

I am trying to use an indexed property following the howto 
(http://www.apache.org/~sraeburn/maven/faqs/indexedprops.html). I also 
read many many related mails on this list, but... :(

I have no problem with the getters, but unfortunately, I can not make it 
work to set the values of the indexed property.

The property is a simple String. The number of  them is completely dynamic.

The output of tomcat seems to indicate that the BeanUtils.populate does 
not see my indexed setter. Here is the output :
...
[DEBUG] RequestProcessor - - Populating bean properties from this request
[DEBUG] BeanUtils - 
-BeanUtils.populate([EMAIL PROTECTED]
f62, {customerCategoryId[2]=[Ljava.lang.String;@1703484, 
customerPhone=[Ljava.la
ng.String;@187e184, customerCategoryId[0]=[Ljava.lang.String;@1e6cf07, 
customerL
astName=[Ljava.lang.String;@2209db, 
customerFirstName=[Ljava.lang.String;@b53b32
, customerAddress=[Ljava.lang.String;@41647f, 
customerCategoryId[1]=[Ljava.lang.
String;@12cd736, customerEmail=[Ljava.lang.String;@e51bda})
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] BeanUtils - -Skipping read-only property
[DEBUG] ConvertUtils - -Convert string 's' to class 'java.lang.String'
[DEBUG] RequestProcessor - - Validating input form properties
[DEBUG] RequestProcessor - - Looking for Action instance for class 
singha.actions.ReservationStep3Action
...

Here is a snippet of my ReservationStep3Form FormBean :
  
   private ArrayList customerCategoryIds = new ArrayList();
  
   public void reset(ActionMapping mapping,
 HttpServletRequest request)
   {
 ...
 customerCategoryIds = new ArrayList();
   }

   public String getCustomerCategoryId(int index){
 System.out.println(getCustomerCategoryId);
 if(index  customerCategoryIds.size()) return 
(String)customerCategoryIds.get(index);
 return null;
   }
  
   public void setCustomerCategroryId(int index, String value){
 if(index = customerCategoryIds.size()) 
customerCategoryIds.ensureCapacity(index+1);
 customerCategoryIds.set(index,  value);
   }

Here is the relevant part of the JSP :
I have a list of positions object from the action. I want to add some 
info to these positons, and in the same form get some infos about the 
customer (name...).

html:form action=reservationStep3
logic:iterate id=position name=positions indexId=index
   html:select property='%= customerCategoryId[ + index + ] %' 
logic:iterate id=price name=position property=value
  html:option value=price.customerCategoryId 
style=text-align:right
  bean:write name=price 
property=customerCategory.name / -
  bean:write name=price property=formattedValue/
  /html:option
/logic:iterate 
  /html:select
/logic:iterate
//other fields (customer name, address etc...)

This JSP generates the right html like :

select name=customerCategoryId[0] 
option value=123 Normal - $14.00/option
...
/select
DO I have to add something to struts-config ? Or what do I have to do, what do I do wrong  ? Any help is really welcome !

Pierre Henry



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


RE: Indexed Property in JSP - Solution

2004-01-06 Thread White, Susan
It took a while, but I got it. Here's the solution I found. Keep in mind
that dateOfBirth property is defined at the form level, not as an child
of acctParties.

  logic:iterate id=thisParty name='purchaseNewForm'
property='acctParties' indexId=idx
  tr valign=bottom
td align=left valign=top class=dkBlue11b
colspan=2
  Please enter the date of birth for
  bean:write name=thisParty
property=firstName/nbsp;
  logic:notEmpty name=thisParty
property=middleName
bean:write name=thisParty
property=middleName/nbsp;
  /logic:notEmpty
  bean:write name=thisParty
property=lastName/nbsp;(MM/DD/)
/td
  /tr
  tr
td colspan=2
!--This will not work-- html:text property='%= dateOfBirth[ + idx
+ ] %' size='10' maxlength='10'/
!--This will not work-- html:text property='dateOfBirth' size='10'
maxlength='10' indexed='true' /
!--This will work--  nested:text property='%= dateOfBirth[ + idx +
] %' size='10' maxlength='10' / 
/td
  /tr
  /logic:iterate

Susan White
Internet Trading / E-Commerce
T. Rowe Price Investment Technologies
410-345-3313
 


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



Indexed Property in JSP

2004-01-02 Thread White, Susan
The form is not setting the value that the user inputs.  I used some of
the posts from this list to create this code and everything compiles,
throws no exceptions but does not work, either. The setter(s) is(are)
not being called Any ideas? 
PS The indexed='true' parameter seems to have no effect present or
absent. 
Thanks! Susan

JSP:
logic:iterate id=thisParty name=acctParties indexId=idx
tr valign=bottom
td align=left valign=top class=dkBlue11b
colspan=2
  Please enter the date of birth for
  bean:write name=thisParty
property=firstName/nbsp;
  logic:notEmpty name=thisParty
property=middleName
bean:write name=thisParty
property=middleName/nbsp;
  /logic:notEmpty
  bean:write name=thisParty
property=lastName/nbsp;(MM/DD/)
/td
/tr
tr
td colspan=2
  html:text property='%= dateOfBirth[ + idx +
] %' indexed='true'/
/td
/tr
/logic:iterate

Java:
private String[] dateOfBirth=null;

/**
 * Returns the dateOfBirth by index.
 * @param int index of array
 * @return String date of birth value
 */
public String getDateOfBirth(int idx) {
if (this.dateOfBirth==null) {
return new String();
} 
else {
if (idx  this.dateOfBirth.length) {
return this.dateOfBirth[idx];
} 
else {
return new String();
}
}
}

/**
 * Sets the dateOfBirth.
 * @param dateOfBirth The dateOfBirth to set
 * @param idx The position of dateOfBirth to set
 */
public void setDateOfBirth(String dateOfBirth, int idx) {
this.dateOfBirth[idx] = dateOfBirth;
}

/**
 * Sets the dateOfBirth.
 * @param dateOfBirth The dateOfBirth to set
 * @param idx The position of dateOfBirth to set
 */
public void setDateOfBirth(String[] dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
/**
 * Returns the dateOfBirth array.
 * @return String array
 */
public String[] getDateOfBirth() {
 return dateOfBirth;
}



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



Re: Indexed Property in JSP

2004-01-02 Thread Kris Schneider
One quick comment - the JavaBean spec defines the 2-arg setter as taking 
an int as the first arg:

public void setDateOfBirth(int idx, String dateOfBirth)

White, Susan wrote:
The form is not setting the value that the user inputs.  I used some of
the posts from this list to create this code and everything compiles,
throws no exceptions but does not work, either. The setter(s) is(are)
not being called Any ideas? 
PS The indexed='true' parameter seems to have no effect present or
absent. 
Thanks! Susan

JSP:
logic:iterate id=thisParty name=acctParties indexId=idx
	tr valign=bottom
		td align=left valign=top class=dkBlue11b
colspan=2
		  Please enter the date of birth for
		  bean:write name=thisParty
property=firstName/nbsp;
		  logic:notEmpty name=thisParty
property=middleName
 		bean:write name=thisParty
property=middleName/nbsp;
		  /logic:notEmpty
 		  bean:write name=thisParty
property=lastName/nbsp;(MM/DD/)
		/td
	/tr
	tr
		td colspan=2
		  html:text property='%= dateOfBirth[ + idx +
] %' indexed='true'/			
	   	/td
	/tr
/logic:iterate

Java:
private String[] dateOfBirth=null;
	/**
	 * Returns the dateOfBirth by index.
	 * @param int index of array
	 * @return String date of birth value
	 */
	public String getDateOfBirth(int idx) {
		if (this.dateOfBirth==null) {
		return new String();
 		} 
 		else {
			if (idx  this.dateOfBirth.length) {
			return this.dateOfBirth[idx];
	 		} 
	 		else {
			return new String();
	 		}
 		}
	}

/**
 * Sets the dateOfBirth.
 * @param dateOfBirth The dateOfBirth to set
 * @param idx The position of dateOfBirth to set
 */
public void setDateOfBirth(String dateOfBirth, int idx) {
this.dateOfBirth[idx] = dateOfBirth;
}
/**
 * Sets the dateOfBirth.
 * @param dateOfBirth The dateOfBirth to set
 * @param idx The position of dateOfBirth to set
 */
public void setDateOfBirth(String[] dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
/**
 * Returns the dateOfBirth array.
 * @return String array
 */
public String[] getDateOfBirth() {
 return dateOfBirth;
}
--
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/


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


RE: Indexed Property in JSP

2004-01-02 Thread Karr, David
Besides the other problem with the order of parameters to the setter,
you also have two setters for the same property.  You'll need to change
the other setter (and the resulting property name) in order for this to
work.

Also, I believe you can remove the 'indexed=true' attribute, as you're
doing your own indexing.

-Original Message-
From: White, Susan [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 02, 2004 12:11 PM
To: [EMAIL PROTECTED]
Subject: Indexed Property in JSP


The form is not setting the value that the user inputs.  I used some of
the posts from this list to create this code and everything compiles,
throws no exceptions but does not work, either. The setter(s) is(are)
not being called Any ideas? 
PS The indexed='true' parameter seems to have no effect present or
absent. 
Thanks! Susan

JSP:
logic:iterate id=thisParty name=acctParties indexId=idx
tr valign=bottom
td align=left valign=top class=dkBlue11b
colspan=2
  Please enter the date of birth for
  bean:write name=thisParty
property=firstName/nbsp;
  logic:notEmpty name=thisParty
property=middleName
bean:write name=thisParty
property=middleName/nbsp;
  /logic:notEmpty
  bean:write name=thisParty
property=lastName/nbsp;(MM/DD/)
/td
/tr
tr
td colspan=2
  html:text property='%= dateOfBirth[ + idx +
] %' indexed='true'/
/td
/tr
/logic:iterate

Java:
private String[] dateOfBirth=null;

/**
 * Returns the dateOfBirth by index.
 * @param int index of array
 * @return String date of birth value
 */
public String getDateOfBirth(int idx) {
if (this.dateOfBirth==null) {
return new String();
} 
else {
if (idx  this.dateOfBirth.length) {
return this.dateOfBirth[idx];
} 
else {
return new String();
}
}
}

/**
 * Sets the dateOfBirth.
 * @param dateOfBirth The dateOfBirth to set
 * @param idx The position of dateOfBirth to set
 */
public void setDateOfBirth(String dateOfBirth, int idx) {
this.dateOfBirth[idx] = dateOfBirth;
}

/**
 * Sets the dateOfBirth.
 * @param dateOfBirth The dateOfBirth to set
 * @param idx The position of dateOfBirth to set
 */
public void setDateOfBirth(String[] dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
/**
 * Returns the dateOfBirth array.
 * @return String array
 */
public String[] getDateOfBirth() {
 return dateOfBirth;
}



-
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]



RE: Help needed : cannot resend an indexed property to request

2003-10-06 Thread shirishchandra.sakhare
%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %

html
head
titleTest Indexed property/title
/head
body

html:form action=/Validate.do
html:text property=a /
table width=650 border=0 cellspacing=0 cellpadding=0
tr align=left
thB/th
thC/th
/tr   
logic:iterate name=testForm
property=beans
id=aBean
indexId=i
type=com.rubis.web.system.TestBean
tr align=left
td
html:text name=testForm property=%=\bean[\+i+\].b\%/
/td
td
html:text name=testForm property=%=\bean[\+i+\].c\%/
/td
/tr
/logic:iterate
html:submitValidate/html:submit 
/table
/html:form
/body
/html

First of all, you need lazy initialisation in your form.//i have assumed the Beans as 
list here.

public TestBean  getBean(int index){
while(index = this.getBeans().size() ){
this.getBeans().add(new TestBean());
}
return (TestBean)this.getBeans().getObject(index);
}

Now in your jsp, when you say html:text name=testForm 
property=%=\bean[\+i+\].b\%/ , it will be interpreted as 
testForm.getBean(i).setB(String )when the form is submitted.And this should work.


-Original Message-
From: Frederic Dernbach [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 05, 2003 4:46 PM
To: struts-layout; struts-user
Subject: Help needed : cannot resend an indexed property to request


Hello, 

I experience big difficulties resend an indexed property of a form as
part of a request. 

I build a super-simple code sample to share with you so you can help me
find the trick. 

I have a form named TestForm; It has one property named 'beans' that is
an array of TestBean. TestBean is a bean that as two strings properties
: 'b' and 'c'. I put the class code below. 

I have two struts actions : '/Test' and '/Validate'. 
- '/Test' populates the form (especially the 'beans' property) and
forwards to the JSP 'test.jsp'. 
- 'test.jsp' displays basic a form property as well as a list (indexed
property).
- 'Validate' is the action called by the form included in 'test.jsp. It
does nothing but forward back to the JSP 'test.jsp'. 
I included the code of those two actions as well as the declarations in
struts-config.xml. 


HERE IS MY PROBLEM :

If I use the 'test.jsp' file below, I get an exception
InvokationTargetException when I hit the validate button (submit button
of the form). I aded the JSP an the exception from BeanUtils.populate()
below.

%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %

html
head
titleTest Indexed property/title
/head
body

html:form action=/Validate.do
html:text property=a /
table width=650 border=0 cellspacing=0 cellpadding=0
tr align=left
thB/th
thC/th
/tr   
logic:iterate name=testForm
property=beans
id=aBean
indexId=i
type=com.rubis.web.system.TestBean
tr align=left
td
html:text name=testForm property=%=\bean[\+i+\].b\%/
/td
td
html:text name=testForm property=%=\bean[\+i+\].c\%/
/td
/tr
/logic:iterate
html:submitValidate/html:submit 
/table
/html:form
/body
/html


java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:493)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:770)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)


QUESTION : how should I write my JSP in order to have the form populated
correctly by Struts before entering the 'Validate' action ? How can I
ensure than the indexed property is resend in the request ?


I tried a modified version of the JSP, with no success (I print here the
logic:iterate tag only). The JSP displays OK, but when I hit the
submit button, Struts does not find any collection :

logic:iterate name=testForm property=beans id=aBean 
tr align=left
td
html:text name=aBean property=b/
html:text name=aBean property=c

Help needed : cannot resend an indexed property to request

2003-10-05 Thread Frederic Dernbach
Hello, 

I experience big difficulties resend an indexed property of a form as
part of a request. 

I build a super-simple code sample to share with you so you can help me
find the trick. 

I have a form named TestForm; It has one property named 'beans' that is
an array of TestBean. TestBean is a bean that as two strings properties
: 'b' and 'c'. I put the class code below. 

I have two struts actions : '/Test' and '/Validate'. 
- '/Test' populates the form (especially the 'beans' property) and
forwards to the JSP 'test.jsp'. 
- 'test.jsp' displays basic a form property as well as a list (indexed
property).
- 'Validate' is the action called by the form included in 'test.jsp. It
does nothing but forward back to the JSP 'test.jsp'. 
I included the code of those two actions as well as the declarations in
struts-config.xml. 


HERE IS MY PROBLEM :

If I use the 'test.jsp' file below, I get an exception
InvokationTargetException when I hit the validate button (submit button
of the form). I aded the JSP an the exception from BeanUtils.populate()
below.

%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %

html
head
titleTest Indexed property/title
/head
body

html:form action=/Validate.do
html:text property=a /
table width=650 border=0 cellspacing=0 cellpadding=0
tr align=left
thB/th
thC/th
/tr   
logic:iterate name=testForm
property=beans
id=aBean
indexId=i
type=com.rubis.web.system.TestBean
tr align=left
td
html:text name=testForm property=%=\bean[\+i+\].b\%/
/td
td
html:text name=testForm property=%=\bean[\+i+\].c\%/
/td
/tr
/logic:iterate
html:submitValidate/html:submit 
/table
/html:form
/body
/html


java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:493)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:770)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)


QUESTION : how should I write my JSP in order to have the form populated
correctly by Struts before entering the 'Validate' action ? How can I
ensure than the indexed property is resend in the request ?


I tried a modified version of the JSP, with no success (I print here the
logic:iterate tag only). The JSP displays OK, but when I hit the
submit button, Struts does not find any collection :

logic:iterate name=testForm property=beans id=aBean 
tr align=left
td
html:text name=aBean property=b/
html:text name=aBean property=c/
/td
/tr
/logic:iterate


I tried another version. This time, I get a NullPointerException :
 
logic:iterate name=testForm property=beans id=beans
tr align=left
td
html:text name=beans property=b indexed=true/
/td
td
html:text name=beans property=c indexed=true/
/td
/tr
/logic:iterate

java.lang.NullPointerException at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:515)



Thanks in advance for your help.

Fred

 TestForm.java ** 

package com.rubis.web.system; 
import javax.servlet.http.HttpServletRequest; 
import org.apache.struts.action.ActionMapping; 
import org.apache.struts.action.ActionForm; 
import com.rubis.web.system.TestBean; 

public class TestForm extends ActionForm implements java.io.Serializable
{ 
public String getA() { 
return a; 
} 
public void setA(String a) { 
this.a = a; 
} 
public TestBean[] getBeans() { 
return beans; 
} 
public void setBeans(TestBean[] beans) { 
this.beans = beans; 
} 
public TestBean getBean(int index) { 
return beans[index]; 
} 
public void setBean(int index, TestBean bean) { 
beans[index] = bean; 
} 
public void reset(ActionMapping mapping, HttpServletRequest request) { 
a = null; 
beans = null; 
} 

private String a; 
private TestBean[] beans; 

} 

 TestBean.java *** 
package com.rubis.web.system; 

public class TestBean { 

public String getB() { 
return b; 
} 
public void setB(String b) { 
this.b = b; 
} 
public String getC() { 
return c

Help needed : cannot resend an indexed property to request (2)

2003-10-05 Thread Frederic Dernbach
I really get  crazy  with Struts indexed properties.

I just posted a message about big difficulties resend an indexed
property of a form as part of a request. I made some progress in
debugging and the result is quite SURPRISING !

I build a super-simple code sample to share with you so you can help me
find the trick. 

I have a form named TestForm; It has one property named 'beans' that is
an array of TestBean. TestBean is a bean that as two strings properties
: 'b' and 'c'. I put the class code below. 

I have two struts actions : '/Test' and '/Validate'. 
- '/Test' populates the form (especially the 'beans' property) and
forwards to the JSP 'test.jsp'. 
- 'test.jsp' displays basic a form property as well as a list (indexed
property).
- 'Validate' is the action called by the form included in 'test.jsp. It
does nothing but forward back to the JSP 'test.jsp'. 
I included the code of those two actions as well as the declarations in
struts-config.xml. 


HERE IS MY PROBLEM :

If I use the 'test.jsp' file below, I get an exception
InvokationTargetException when I hit the validate button (submit button
of the form). I added the JSP an the exception from BeanUtils.populate()
below.

html
head
titleTest Indexed property/title
/head
body

html:form action=/Validate.do

html:text property=a /

table width=650 border=0 cellspacing=0 cellpadding=0
tr align=left
thB/th
thC/th
/tr   
logic:iterate name=testForm
property=beans
id=bean
indexId=i
type=com.rubis.web.system.TestBean
tr align=left
td
html:text name=bean property=b indexed=true/
/td
td
html:text name=bean property=c indexed=true/
/td
/tr
/logic:iterate
html:submitValidate/html:submit 
/table
/html:form

/body
/html

Here is the exception :
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
.../...
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)


I think I did everything OK:
- Class TestForm has the following methods
public TestBean[] getBeans();
public void setBeans(TestBean[] beans);
public TestBean getBean(int index)
public void setBean(int index, TestBean bean)
- The logic:iterate tag of 'test.jsp' file has an 'id' attribute equal
to the attributes 'name' of the nested html:text tags (as required)

Here is what are my debugging findings. I traced the populate() method
of Struts class BeanUtils. It invokes the public TestBean getBean(int
index) method with an Integer argument and not an int one !!

The exception happens in method public static Object
getIndexedProperty(Object bean,String name, int index) of class
org.apache.commons.beanutils.PropertyUtils with the following arguments:
- 'bean' : the TestForm instance
- 'name' : bean (String)
- 'index' : 1 (int)
In this routine, it finds public TestBean getBean(int index) in the
form's class puts it in a 'readMethod' local variable and executes :
Object subscript[] = new Object[1];
subscript[0] = new Integer(index);
try {
return (readMethod.invoke(bean, subscript));
} catch (InvocationTargetException e) {
.../...
}
= STRUTS CALLS the public TestBean getBean(int index) method with an
Integer argument, and not an int.

Does anybody have an idea about this problem ?

Thanks in advance for your help.

Fred


 TestForm.java ** 

package com.rubis.web.system; 
import javax.servlet.http.HttpServletRequest; 
import org.apache.struts.action.ActionMapping; 
import org.apache.struts.action.ActionForm; 
import com.rubis.web.system.TestBean; 

public class TestForm extends ActionForm implements java.io.Serializable
{ 
public String getA() { 
return a; 
} 
public void setA(String a) { 
this.a = a; 
} 
public TestBean[] getBeans() { 
return beans; 
} 
public void setBeans(TestBean[] beans) { 
this.beans = beans; 
} 
public TestBean getBean(int index) { 
return beans[index]; 
} 
public void setBean(int index, TestBean bean) { 
beans[index] = bean; 
} 
public void reset(ActionMapping mapping, HttpServletRequest request) { 
a = null; 
beans = null; 
} 

private String a; 
private TestBean[] beans; 

} 

 TestBean.java *** 
package com.rubis.web.system; 

public class TestBean { 

public String getB() { 
return b; 
} 
public void setB(String b) { 
this.b = b; 
} 
public String getC() { 
return c; 
} 
public void setC(String c) { 
this.c = c; 
} 
private String b; 
private String c; 

} 

*** struts-config.xml  
action path=/Test 
type=com.rubis.web.system.TestAction 
scope=request 
name=testForm 
validate=false 
attribute=testForm 
forward name=success path=/test.jsp / 
/action
 
action path=/Validate 
type=com.rubis.web.system.ValidateAction

Re: Html tags and indexed property - how does it work?

2003-09-27 Thread Graham Leggett
Ted Husted wrote:

This is really a USER list question, but you may be looking for the 
indexed properties how-to:

http://jakarta.apache.org/struts/faqs/indexedprops.html
I have gone through this howto, but its description of what to do is 
very vague. Here is what I have tried so far:

I have a DynaActionForm with properties defined like so:

  form-property
name=policycoverLess
type=java.lang.String[] /
  form-property
name=policycoverSumInsureds
type=java.lang.String[] /
I populate the above inside my action, and display it successfully 
something like so:

logic:iterate id=policycoverName indexId=index name=form 
property=policycoverNames
  html:text indexed=true property=%=\policycoverSumInsureds[\ + 
index + \]\% size=15 /
  html:submit indexed=true property=policycoverLess value=- /
/logic:iterate

The above html renders an input text tag, and a submit tag, with correct 
values populated from the DynaActionForm, but incorrect names:

org.apache.struts.taglib.html.BEAN[0].policycoverSumInsureds[0]
policycoverLess[0]
If I submit the form using an external-to-the-above=loop submit button, 
I get no errors, and the DynaActionForm bean is _not_ populated with the 
input text field, which is ignored.

If I attempt to use the policycoverLess submit button, struts bombs 
out with the following exception:

java.lang.ArrayIndexOutOfBoundsException
	at java.lang.reflect.Array.set(Native Method)
	at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:459)
	at 
org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.java:1414)
	at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
	at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1104)

Can anyone shed any light on what I am doing wrong, or can give me a 
piece of clear example code to show what I should be doing?

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


Re: Indexed property names - the real story

2003-08-20 Thread Lynda Brown
The problem is that you end up having two identically named methods that return 
different types.  How is the compiler supposed to know which one to use?  I had this 
same problem myself for a while, because you are right that is what seems to follow 
JavaBean specs.  But your solution is exactly what you should do, you are still 
following spec because you do have a getter method with the correct name.  You just 
also have an additional getter method to return one within the List.  I think this 
answers your question.
 
:)

Richard Mixon [EMAIL PROTECTED] wrote: 
First, sorry for the long posting - it shorter than a few, but not many :).

I've read a number of very good postings on the list on how to handle
indexed properties using the having a bit of a problem determining what the 
corresponding getter/setter
names should be.

The problem is naming of the getter for my list of line items. At first I
had the following signatures

// First to get and set the entire list
public List getCurrLineItems() ...
public void setCurrLineItems(List lineItems) ...

// Next to get and set individual indexed items in the list
public LineItem getCurrLineItems(int liDex) ...
public void setCurrLineItems(int liDex, LineItem lineItem) ...

With the indexed getter/setters as above, it does not work. However, if I
name them differently from the List getter/setters they work (for example
names then getCurrentLineItems and setCurrentLineItems instead of
getCurrLineItems and setCurrLineItems). This appears to be contrary to all
of the examples I can find and the JavaBeans spec. Before proceeding I want
to clear this up.

With the matching names for indexed properties I could not get my JSP page
to see the line items. I tried the logic:iterate, nested:iterate and
logic-el:iterate variations of the Struts iterate tag. I also tried using
a JSTL 


Existing Line Items



Delete




key=formLineItemsForm.status/
Act  Inact

property=currLineItems indexId=mpDex

property=deleteXMP[${mpDex}] value=true title=Check to delete and press
Change/
 
property=name size=24 maxlength=24 indexed=true/

indexed=true
labelProperty=name/


size=1 maxlength=2 indexed=true /

value=1 indexed=true/ property=status_id value=2 indexed=true/

indexed=true/
indexed=true/
indexed=true/








...
JSP - fragment - END


FormBean - BEGIN
public class OrderLineForm extends com.ltoj.webapp.form.BaseForm implements
java.io.Serializable {

private OrderForm base = new OrderForm();
private List deleteXMP = new ArrayList();
private List currLineItems = new ArrayList();
private List newLineItems = new ArrayList(1);

public OrderForm getBase() { return base; }

public void setBase(OrderForm subject) { this.base = subject; }

/**
* Flags, set if corresponding existing line item should be deleted.
*/
public List getDeleteXMP() { return deleteXMP; }
public String getDeleteXMP(int mpDex) { return
(String)this.deleteXMP.get(mpDex); }

public void setDeleteXMP(List deleteXMP) { this.deleteXMP = deleteXMP; }
public void setDeleteXMP(int mpDex, String deleteXMP) {
this.deleteXMP.add(deleteXMP); }

public List getCurrLineItems() { return this.currLineItems; }
public LineItemsForm getCurrMeasurementParms(int mpDex) { return
(LineItemsForm)this.currLineItems.get(mpDex); }

public void setCurrLineItems( List currLineItems ) { this.currLineItems
= currLineItems; }
public void setCurrMeasurementParms( int mpDex, LineItemsForm
currLineItem ) { this.currLineItems.add(currLineItem); }

public List getNewLineItems() { return this.newLineItems; }
public LineItemsForm getNewMeasurementParms(int mpDex) { return
(LineItemsForm)this.newLineItems.get(mpDex); }

public void setNewLineItems( List newLineItems ) { this.newLineItems =
newLineItems; }
public void setNewMeasurementParms( int mpDex, LineItemsForm
newLineItem ) { this.newLineItems.add(newLineItem); }

public void reset(ActionMapping mapping, HttpServletRequest request) {
base = new OrderForm();
deleteXMP = new ArrayList();
currLineItems = new ArrayList();
newLineItems = new ArrayList(1);
}
}
FormBean - END



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




-
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

RE: Indexed property names - the real story

2003-08-20 Thread Richard Mixon
Linda,

Thanks - that cleared things up. Things are working great now that I let the
indexed methods use a different name. Many of the examples and howtos on
indexed properties are not at all clear on this.

The list methods turn out to only be needed by my action class, so the fact
that their names do not correspond to the the property= name on my JSP does
not really matter.

 - Richard



 -Original Message-
From: Lynda Brown [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 11:40 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Indexed property names - the real story


The problem is that you end up having two identically named methods that
return different types.  How is the compiler supposed to know which one to
use?  I had this same problem myself for a while, because you are right that
is what seems to follow JavaBean specs.  But your solution is exactly what
you should do, you are still following spec because you do have a getter
method with the correct name.  You just also have an additional getter
method to return one within the List.  I think this answers your question.

:)

Richard Mixon [EMAIL PROTECTED] wrote:
  First, sorry for the long posting - it shorter than a few, but not many
:).

  I've read a number of very good postings on the list on how to handle
  indexed properties using the having a bit of a problem determining what
the corresponding getter/setter
  names should be.

  The problem is naming of the getter for my list of line items. At first I
  had the following signatures

  // First to get and set the entire list
  public List getCurrLineItems() ...
  public void setCurrLineItems(List lineItems) ...

  // Next to get and set individual indexed items in the list
  public LineItem getCurrLineItems(int liDex) ...
  public void setCurrLineItems(int liDex, LineItem lineItem) ...

  With the indexed getter/setters as above, it does not work. However, if I
  name them differently from the List getter/setters they work (for example
  names then getCurrentLineItems and setCurrentLineItems instead of
  getCurrLineItems and setCurrLineItems). This appears to be contrary to all
  of the examples I can find and the JavaBeans spec. Before proceeding I
want
  to clear this up.

  With the matching names for indexed properties I could not get my JSP page
  to see the line items. I tried the logic:iterate, nested:iterate and
  logic-el:iterate variations of the Struts iterate tag. I also tried
using
  a JSTL 


  Existing Line Items



   Delete




   key=formLineItemsForm.status/
Act  Inact


property=currLineItems indexId=mpDex

   property=deleteXMP[${mpDex}] value=true title=Check to delete
and press
Change/

property=name size=24 maxlength=24 indexed=true/

indexed=true
labelProperty=name/


size=1 maxlength=2 indexed=true /

value=1 indexed=true/ property=status_id value=2
indexed=true/

indexed=true/
indexed=true/
indexed=true/









  ...
  JSP - fragment - END


  FormBean - BEGIN
  public class OrderLineForm extends com.ltoj.webapp.form.BaseForm
implements
  java.io.Serializable {

  private OrderForm base = new OrderForm();
  private List deleteXMP = new ArrayList();
  private List currLineItems = new ArrayList();
  private List newLineItems = new ArrayList(1);

  public OrderForm getBase() { return base; }

  public void setBase(OrderForm subject) { this.base = subject; }

  /**
  * Flags, set if corresponding existing line item should be deleted.
  */
  public List getDeleteXMP() { return deleteXMP; }
  public String getDeleteXMP(int mpDex) { return
  (String)this.deleteXMP.get(mpDex); }

  public void setDeleteXMP(List deleteXMP) { this.deleteXMP = deleteXMP; }
  public void setDeleteXMP(int mpDex, String deleteXMP) {
  this.deleteXMP.add(deleteXMP); }

  public List getCurrLineItems() { return this.currLineItems; }
  public LineItemsForm getCurrMeasurementParms(int mpDex) { return
  (LineItemsForm)this.currLineItems.get(mpDex); }

  public void setCurrLineItems( List currLineItems ) { this.currLineItems
  = currLineItems; }
  public void setCurrMeasurementParms( int mpDex, LineItemsForm
  currLineItem ) { this.currLineItems.add(currLineItem); }

  public List getNewLineItems() { return this.newLineItems; }
  public LineItemsForm getNewMeasurementParms(int mpDex) { return
  (LineItemsForm)this.newLineItems.get(mpDex); }

  public void setNewLineItems( List newLineItems ) { this.newLineItems =
  newLineItems; }
  public void setNewMeasurementParms( int mpDex, LineItemsForm
  newLineItem ) { this.newLineItems.add(newLineItem); }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
  base = new OrderForm();
  deleteXMP = new ArrayList();
  currLineItems = new ArrayList();
  newLineItems = new ArrayList(1);
  }
  }
  FormBean - END



  -
  To unsubscribe, e-mail

Indexed property names - the real story

2003-08-19 Thread Richard Mixon
First, sorry for the long posting - it shorter than a few, but not many :).

I've read a number of very good postings on the list on how to handle
indexed properties using the logic:iterate tag. In spite of this I'm
having a bit of a problem determining what the corresponding getter/setter
names should be.

The problem is naming of the getter for my list of line items. At first I
had the following signatures

  // First to get and set the entire list
  public List getCurrLineItems() ...
  public void setCurrLineItems(List lineItems) ...

  // Next to get and set individual indexed items in the list
  public LineItem getCurrLineItems(int liDex) ...
  public void setCurrLineItems(int liDex, LineItem lineItem) ...

With the indexed getter/setters as above, it does not work. However, if I
name them differently from the List getter/setters they work (for example
names then getCurrentLineItems and setCurrentLineItems instead of
getCurrLineItems and setCurrLineItems). This appears to be contrary to all
of the examples I can find and the JavaBeans spec. Before proceeding I want
to clear this up.

With the matching names for indexed properties I could not get my JSP page
to see the line items. I tried the logic:iterate, nested:iterate and
logic-el:iterate variations of the Struts iterate tag. I also tried using
a JSTL c:forEach  loop.
In my action, I set the form bean in the request, could print the form bean
and see all of the line items, . But when it got to the JSP page, BeanUtils
said there currLineItems property was empty.

After deciding that there might be a problem with my property names
(grasping at straws), I discovered that using different names for the
indexed methods seems to have fixed things.

Any ideas on why this is happening. Better yet, how should things work?

I've cut down a piece of my JSP page and my form bean below, trying to keep
enough info without making it too long to read.

JSP - fragment - BEGIN
logic:present name=orderLineForm
  logic:present name=orderLineForm property=currLineItems
logic:notEmpty name=orderLineForm property=currLineItems
  trtd colspan=4 width=725Existing Line Items/td/tr
  trtd colspan=4 width=725
  table
tr
  thDelete/th
  thnbsp;nbsp;nbsp;nbsp;/th
  thbean:message key=formLineItemsForm.name//th
  thbean:message key=formLineItemsForm.measurementUnit//th
  thbean:message key=formLineItemsForm.displayDecimals//th
  th bean:message
key=formLineItemsForm.status/brActnbsp;nbsp;Inact/th
/tr
  nested:iterate id=currLineItems name=orderLineForm
property=currLineItems indexId=mpDex
tr
  tdhtml-el:checkbox name=orderLineForm
property=deleteXMP[${mpDex}] value=true title=Check to delete and press
Change//td
  tdnbsp;/td
  td   nested:text name=currLineItems
property=name   size=24 maxlength=24 indexed=true//td
  td
html:select name=currLineItems property=measurementUnit_id
indexed=true
  html:options collection=measurementUnits property=id
labelProperty=name/
/html:select
  /td
  td nested:text name=currLineItems property=displayDecimals
size=1  maxlength=2 indexed=true //td
  td
nested:radio name=currLineItems property=status_id
value=1 indexed=true/nbsp;nested:radio name=currLineItems
property=status_id value=2 indexed=true/
  /td
  tdnested:hidden name=currLineItems property=measurementUnit
indexed=true//td
  tdnested:hidden name=currLineItems property=order
indexed=true//td
  tdnested:hidden name=currLineItems property=order_id
indexed=true//td
/tr
  /nested:iterate
  /table
/td
  /tr
/logic:notEmpty
  /logic:present
/logic:present
...
JSP - fragment - END


FormBean - BEGIN
public class OrderLineForm extends com.ltoj.webapp.form.BaseForm implements
java.io.Serializable {

private OrderForm base = new OrderForm();
private List deleteXMP = new ArrayList();
private List currLineItems = new ArrayList();
private List newLineItems = new ArrayList(1);

public OrderForm getBase() { return base; }

public void setBase(OrderForm subject) { this.base = subject; }

/**
 *  Flags, set if corresponding existing line item should be deleted.
 */
public List getDeleteXMP() { return deleteXMP; }
public String getDeleteXMP(int mpDex) { return
(String)this.deleteXMP.get(mpDex); }

public void setDeleteXMP(List deleteXMP) { this.deleteXMP = deleteXMP; }
public void setDeleteXMP(int mpDex, String deleteXMP) {
this.deleteXMP.add(deleteXMP); }

public List getCurrLineItems() { return this.currLineItems; }
public LineItemsForm getCurrMeasurementParms(int mpDex) { return
(LineItemsForm)this.currLineItems.get(mpDex); }

public void setCurrLineItems( List currLineItems ) { this.currLineItems
= currLineItems; }
public void setCurrMeasurementParms( int 

Indexed Property!

2003-07-25 Thread manglu
Hi,

I am unable to get a good handle of Indexed Property(ies)

This is what i want to achieve.

The users need to specify their interests when they register and their 
options are provided via checkboxes - say Sports, Politics and Computers

I presume the attribute in the form object should be a collection object 
say an ArrayList

How would the jsp look like for the Check Boxes?

Appreciate some code samples. I presume that all the selected objects 
(lets' say the User Selects Sports Computers) would be sent in the 
Action Form when the user hits submit

Eagerly awaiting for some Code Samples

TIA
Manglu




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


Indexed Property Problem.

2003-07-08 Thread Anurag Garg
Hi All,

I know this question would have been posted earlier also.
I want to know how to work with the indexed form fields and their property
in the action form class.
Any link or ample code will be helpful.

Anurag Garg


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



RE: Repost: Validator indexed property not working in Struts 1.1 Final Release

2003-07-02 Thread Wu, Feng
Thanks, I have opened a bug report on item one, it is at 
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21254.  Regarding the second item, 
is there a paticular reason that the validator is designed to stops validating a list 
of values on the first failure?  This morning I actually modified Validator.java so 
that it validates all memebers of the list and saves error messages for them all.  So 
now I get it to display like this:

value is mandatory
value is mandatory
value is mandatory

This is of course not very clear to the user, because I really wanted is to display:

nameList value 1 is mandatory
nameList value 2 is mandatory
nameList value 3 is mandatory

I guess I still need to figure out a way of contructing the error messages in a 
different way so that it works for both indexed and non-indexed property.

On the other hand, the validwhen rules that's supposed to come after 1.1 final, will 
it be able to handle this kind of validation?  How difficult it would be possible to 
plug that piece into Strut 1.1?  The reason I ask is because it will be much difficult 
for me to sell to the management the idea of delivering our project on nightly build 
than on Struts 1.1 final.


Thanks a lot.

Feng


-Original Message-
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 01, 2003 3:21 PM
To: Struts Users Mailing List
Subject: Re: Repost: Validator indexed property not working in Struts
1.1 Final Release


--- Wu, Feng [EMAIL PROTECTED] wrote:
 Seems like my previous email to the list did not make it.  Here it goes
 again.  Thanks.
 
 By the way, I can work around the problem of nested:messagePresent not
 finding the ActionError by mannualy generating the property attribute
 like this:
   nested:messagesPresent  property='%= nameList[ + i + ].value %'
 
 But this kind of defeated the purpose of nested tags, does it?

It is indeed broken in 1.1 final and 1.1 RC2 (1.1 RC1 works fine).  Please
open a bug report on the tag so we can track this in bugzilla.

 
 I still could not figure out why there is only ActionError (for property
 nameList[0].value) is in request scope when I should have three, since
 nameList[1].value and nameList[2].value are blank and should fail
 validation.

This is a current limitation of the validator.  It stops validating a list
of values on the first failure.

David

 
 Thank you.
 
 Feng
 
 -Original Message-
 From: Wu, Feng 
 Sent: Monday, June 30, 2003 5:08 PM
 To: 
 Subject: Validator indexed property not working in Struts 1.1 Final
 Release
 
 
 Hi,
 
 First, great works on Struts 1.1 final release.  Just in time since we
 are designing a major project using Struts.
 
 Got a couple questions regarding validator and indexed properties in
 Struts 1.1 final release:
 
 1. Seems that the validation of indexed property in struts-validator
 application (in type.jsp) is broken.  Specifically the page has an
 indexed property nameList[].value.  After I switched to Struts 1.1
 final, the error message no longer shows up.  Does any one has the same
 problem?  I knew this was working in RC1.
 
 In request scope, I saw ActionError saved for property
 nameList[0].value.  In type.jsp the following code is used to output
 errors for this property:
 
  nested:messagesPresent property=value
 br
 ul
nested:messages id=error property=value
   libean:write name=error//li
/nested:messages
 /ul
  /nested:messagesPresent
 
 It seems nested:message can no longer match up value with
 nameList[0].value.
 
 Any expert opinions on this?
 
 2. Related (this is not 1.1 final release specific), say I want to
 display error messages for all the members of an indexed property, i.e.,
 in the type.jsp example, I want to display like:
 
 * nameList value 1 is mandatory
 * nameList value 2 is mandatory
 * nameList value 3 is mandatory
 
 instead of just displaying nameList value is mandatory only once even
 though all three fields are blank.  Is there a simple way of doing that?
  Again, looks like only nameList[0].value is used as the key to save an
 ActionError when all three fields are blank (thus all warranting error
 messages).
 
 Is it the designed behavior to save only one ActionError for indexed
 property no matter how many actual members of the indexed property
 actually have?
 
 Thanks very much.
 
 Feng
 
 
 
 
 ***
 This e-mail and any files transmitted with it are intended 
 solely for the use of the addressee.  This e-mail may 
 contain confidential and/or legally privileged information.  
 Any review, transmission, disclosure, copying, or any action 
 taken or not taken, by other than the intended recipient, in 
 reliance on the information, is prohibited.  If you received 
 this e-mail in error, notify the sender and delete this e-mail 
 (and any accompanying material) from your computer

RE: Repost: Validator indexed property not working in Struts 1.1 Final Release

2003-07-02 Thread David Graham
--- Wu, Feng [EMAIL PROTECTED] wrote:
 Thanks, I have opened a bug report on item one, it is at
 http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21254.  Regarding the
 second item, is there a paticular reason that the validator is designed
 to stops validating a list of values on the first failure?  

It's not really designed that way, it just doesn't work right now.  I
haven't investigated what it would take to make this work yet.

David

 This
 morning I actually modified Validator.java so that it validates all
 memebers of the list and saves error messages for them all.  So now I
 get it to display like this:
 
 value is mandatory
 value is mandatory
 value is mandatory
 
 This is of course not very clear to the user, because I really wanted is
 to display:
 
 nameList value 1 is mandatory
 nameList value 2 is mandatory
 nameList value 3 is mandatory
 
 I guess I still need to figure out a way of contructing the error
 messages in a different way so that it works for both indexed and
 non-indexed property.
 
 On the other hand, the validwhen rules that's supposed to come after 1.1
 final, will it be able to handle this kind of validation?  How difficult
 it would be possible to plug that piece into Strut 1.1?  The reason I
 ask is because it will be much difficult for me to sell to the
 management the idea of delivering our project on nightly build than on
 Struts 1.1 final.
 
 
 Thanks a lot.
 
 Feng
 
 
 -Original Message-
 From: David Graham [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 01, 2003 3:21 PM
 To: Struts Users Mailing List
 Subject: Re: Repost: Validator indexed property not working in Struts
 1.1 Final Release
 
 
 --- Wu, Feng [EMAIL PROTECTED] wrote:
  Seems like my previous email to the list did not make it.  Here it
 goes
  again.  Thanks.
  
  By the way, I can work around the problem of nested:messagePresent not
  finding the ActionError by mannualy generating the property attribute
  like this:
  nested:messagesPresent  property='%= nameList[ + i + ].value
 %'
  
  But this kind of defeated the purpose of nested tags, does it?
 
 It is indeed broken in 1.1 final and 1.1 RC2 (1.1 RC1 works fine). 
 Please
 open a bug report on the tag so we can track this in bugzilla.
 
  
  I still could not figure out why there is only ActionError (for
 property
  nameList[0].value) is in request scope when I should have three, since
  nameList[1].value and nameList[2].value are blank and should fail
  validation.
 
 This is a current limitation of the validator.  It stops validating a
 list
 of values on the first failure.
 
 David
 
  
  Thank you.
  
  Feng
  
  -Original Message-
  From: Wu, Feng 
  Sent: Monday, June 30, 2003 5:08 PM
  To: 
  Subject: Validator indexed property not working in Struts 1.1 Final
  Release
  
  
  Hi,
  
  First, great works on Struts 1.1 final release.  Just in time since we
  are designing a major project using Struts.
  
  Got a couple questions regarding validator and indexed properties in
  Struts 1.1 final release:
  
  1. Seems that the validation of indexed property in struts-validator
  application (in type.jsp) is broken.  Specifically the page has an
  indexed property nameList[].value.  After I switched to Struts 1.1
  final, the error message no longer shows up.  Does any one has the
 same
  problem?  I knew this was working in RC1.
  
  In request scope, I saw ActionError saved for property
  nameList[0].value.  In type.jsp the following code is used to output
  errors for this property:
  
   nested:messagesPresent property=value
  br
  ul
 nested:messages id=error property=value
libean:write name=error//li
 /nested:messages
  /ul
   /nested:messagesPresent
  
  It seems nested:message can no longer match up value with
  nameList[0].value.
  
  Any expert opinions on this?
  
  2. Related (this is not 1.1 final release specific), say I want to
  display error messages for all the members of an indexed property,
 i.e.,
  in the type.jsp example, I want to display like:
  
  * nameList value 1 is mandatory
  * nameList value 2 is mandatory
  * nameList value 3 is mandatory
  
  instead of just displaying nameList value is mandatory only once
 even
  though all three fields are blank.  Is there a simple way of doing
 that?
   Again, looks like only nameList[0].value is used as the key to save
 an
  ActionError when all three fields are blank (thus all warranting error
  messages).
  
  Is it the designed behavior to save only one ActionError for indexed
  property no matter how many actual members of the indexed property
  actually have?
  
  Thanks very much.
  
  Feng
  
  
  
  
 
 ***
  This e-mail and any files transmitted with it are intended 
  solely for the use of the addressee.  This e-mail may 
  contain confidential and/or legally privileged

Repost: Validator indexed property not working in Struts 1.1 Final Release

2003-07-01 Thread Wu, Feng
Seems like my previous email to the list did not make it.  Here it goes again.  Thanks.

By the way, I can work around the problem of nested:messagePresent not finding the 
ActionError by mannualy generating the property attribute like this:
nested:messagesPresent  property='%= nameList[ + i + ].value %'

But this kind of defeated the purpose of nested tags, does it?

I still could not figure out why there is only ActionError (for property 
nameList[0].value) is in request scope when I should have three, since 
nameList[1].value and nameList[2].value are blank and should fail validation.

Thank you.

Feng

-Original Message-
From: Wu, Feng 
Sent: Monday, June 30, 2003 5:08 PM
To: 
Subject: Validator indexed property not working in Struts 1.1 Final
Release


Hi,

First, great works on Struts 1.1 final release.  Just in time since we are designing a 
major project using Struts.

Got a couple questions regarding validator and indexed properties in Struts 1.1 final 
release:

1. Seems that the validation of indexed property in struts-validator application (in 
type.jsp) is broken.  Specifically the page has an indexed property nameList[].value.  
After I switched to Struts 1.1 final, the error message no longer shows up.  Does any 
one has the same problem?  I knew this was working in RC1.

In request scope, I saw ActionError saved for property nameList[0].value.  In type.jsp 
the following code is used to output errors for this property:

 nested:messagesPresent property=value
br
ul
   nested:messages id=error property=value
  libean:write name=error//li
   /nested:messages
/ul
 /nested:messagesPresent

It seems nested:message can no longer match up value with nameList[0].value.

Any expert opinions on this?

2. Related (this is not 1.1 final release specific), say I want to display error 
messages for all the members of an indexed property, i.e., in the type.jsp example, I 
want to display like:

* nameList value 1 is mandatory
* nameList value 2 is mandatory
* nameList value 3 is mandatory

instead of just displaying nameList value is mandatory only once even though all 
three fields are blank.  Is there a simple way of doing that?  Again, looks like only 
nameList[0].value is used as the key to save an ActionError when all three fields are 
blank (thus all warranting error messages).

Is it the designed behavior to save only one ActionError for indexed property no 
matter how many actual members of the indexed property actually have?

Thanks very much.

Feng




***
This e-mail and any files transmitted with it are intended 
solely for the use of the addressee.  This e-mail may 
contain confidential and/or legally privileged information.  
Any review, transmission, disclosure, copying, or any action 
taken or not taken, by other than the intended recipient, in 
reliance on the information, is prohibited.  If you received 
this e-mail in error, notify the sender and delete this e-mail 
(and any accompanying material) from your computer and
network. In addition, please be advised that 21st Century 
Insurance Group reserves the right to monitor, access and 
review all messages, data and images transmitted through 
our electronic mail system. By using our e-mail system, you 
consent to this monitoring. 
***


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



Re: Repost: Validator indexed property not working in Struts 1.1 Final Release

2003-07-01 Thread David Graham
--- Wu, Feng [EMAIL PROTECTED] wrote:
 Seems like my previous email to the list did not make it.  Here it goes
 again.  Thanks.
 
 By the way, I can work around the problem of nested:messagePresent not
 finding the ActionError by mannualy generating the property attribute
 like this:
   nested:messagesPresent  property='%= nameList[ + i + ].value %'
 
 But this kind of defeated the purpose of nested tags, does it?

It is indeed broken in 1.1 final and 1.1 RC2 (1.1 RC1 works fine).  Please
open a bug report on the tag so we can track this in bugzilla.

 
 I still could not figure out why there is only ActionError (for property
 nameList[0].value) is in request scope when I should have three, since
 nameList[1].value and nameList[2].value are blank and should fail
 validation.

This is a current limitation of the validator.  It stops validating a list
of values on the first failure.

David

 
 Thank you.
 
 Feng
 
 -Original Message-
 From: Wu, Feng 
 Sent: Monday, June 30, 2003 5:08 PM
 To: 
 Subject: Validator indexed property not working in Struts 1.1 Final
 Release
 
 
 Hi,
 
 First, great works on Struts 1.1 final release.  Just in time since we
 are designing a major project using Struts.
 
 Got a couple questions regarding validator and indexed properties in
 Struts 1.1 final release:
 
 1. Seems that the validation of indexed property in struts-validator
 application (in type.jsp) is broken.  Specifically the page has an
 indexed property nameList[].value.  After I switched to Struts 1.1
 final, the error message no longer shows up.  Does any one has the same
 problem?  I knew this was working in RC1.
 
 In request scope, I saw ActionError saved for property
 nameList[0].value.  In type.jsp the following code is used to output
 errors for this property:
 
  nested:messagesPresent property=value
 br
 ul
nested:messages id=error property=value
   libean:write name=error//li
/nested:messages
 /ul
  /nested:messagesPresent
 
 It seems nested:message can no longer match up value with
 nameList[0].value.
 
 Any expert opinions on this?
 
 2. Related (this is not 1.1 final release specific), say I want to
 display error messages for all the members of an indexed property, i.e.,
 in the type.jsp example, I want to display like:
 
 * nameList value 1 is mandatory
 * nameList value 2 is mandatory
 * nameList value 3 is mandatory
 
 instead of just displaying nameList value is mandatory only once even
 though all three fields are blank.  Is there a simple way of doing that?
  Again, looks like only nameList[0].value is used as the key to save an
 ActionError when all three fields are blank (thus all warranting error
 messages).
 
 Is it the designed behavior to save only one ActionError for indexed
 property no matter how many actual members of the indexed property
 actually have?
 
 Thanks very much.
 
 Feng
 
 
 
 
 ***
 This e-mail and any files transmitted with it are intended 
 solely for the use of the addressee.  This e-mail may 
 contain confidential and/or legally privileged information.  
 Any review, transmission, disclosure, copying, or any action 
 taken or not taken, by other than the intended recipient, in 
 reliance on the information, is prohibited.  If you received 
 this e-mail in error, notify the sender and delete this e-mail 
 (and any accompanying material) from your computer and
 network. In addition, please be advised that 21st Century 
 Insurance Group reserves the right to monitor, access and 
 review all messages, data and images transmitted through 
 our electronic mail system. By using our e-mail system, you 
 consent to this monitoring. 
 ***
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



Error when using ValidatorForm when having indexed property

2003-06-22 Thread Kelvin wu
Help,

when i use Validator form with indexed property, it goes errors.
i cannot use the validator framework to validate my field.
Would anyone give some suggestions?

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



Re: Error when using ValidatorForm when having indexed property

2003-06-22 Thread Dan Tran
post a snipet of your actionform and your validation file

-D
- Original Message - 
From: Kelvin wu [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, June 21, 2003 11:15 PM
Subject: Error when using ValidatorForm when having indexed property


 Help,
 
 when i use Validator form with indexed property, it goes errors.
 i cannot use the validator framework to validate my field.
 Would anyone give some suggestions?
 
 -
 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]



Error Message: Invalid indexed property

2003-06-11 Thread Sashi Ravipati
Hi

I am using logic:iterate tag as shown below

logic:iterate id=element name=addRateForm   property=firstName  indexId=i 
  tr
  % int j = ((Integer) pageContext.getAttribute(i)).intValue();  %
   tdhtml:text name=addRateForm property=firstName[%=j%]/td
  
  /tr 
/logic:iterate

Error Message: Invalid indexed property  'firstName[]' 

I did print the vlaues of j and they are fine. 


What am i doing wrong in the above expression. 

Thanks


Re: Error Message: Invalid indexed property

2003-06-11 Thread Gemes Tibor
Sashi R

  tdhtml:text name=addRateForm property=firstName[%=j%]/td
 

runtime props must start w/ %=
so
html:text name=addRateForm property='%= firstName[  + j + ] %'/

bui I would learn use nested taglibs if I were you.

Tib



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


RE: Error Message: Invalid indexed property

2003-06-11 Thread O_Parthasarathy Kesavaraj
try like this
% String fname=firstName[+j+];%
  tdhtml:text name=addRateForm property=%=fname%/td
i didnt check it.pardon me if it doesn't work
Partha

 --
 From: Sashi Ravipati[SMTP:[EMAIL PROTECTED]
 Reply To: Struts Users Mailing List
 Sent: Wednesday, June 11, 2003 5:48 PM
 To:   [EMAIL PROTECTED]
 Subject:  Error Message: Invalid indexed property
 
 Hi
 
 I am using logic:iterate tag as shown below
 
 logic:iterate id=element name=addRateForm   property=firstName
 indexId=i 
   tr
   % int j = ((Integer)
 pageContext.getAttribute(i)).intValue();  %
tdhtml:text name=addRateForm
 property=firstName[%=j%]/td
   
   /tr 
 /logic:iterate
 
 Error Message: Invalid indexed property  'firstName[]' 
 
 I did print the vlaues of j and they are fine. 
 
 
 What am i doing wrong in the above expression. 
 
 Thanks
 

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



RE: Error Message: Invalid indexed property

2003-06-11 Thread Sashi Ravipati
I tried that it works , but I have many HTML elements like that and I
would like to use 
html:text name=addRateForm  property=firstName[%=j%]/

so that I dont have to create different String objects.

Thanks


 [EMAIL PROTECTED] 06/11/03 08:57AM 
try like this
% String fname=firstName[+j+];%
  tdhtml:text name=addRateForm property=%=fname%/td
i didnt check it.pardon me if it doesn't work
Partha

 --
 From: Sashi Ravipati[SMTP:[EMAIL PROTECTED]
 Reply To: Struts Users Mailing List
 Sent: Wednesday, June 11, 2003 5:48 PM
 To: [EMAIL PROTECTED]
 Subject: Error Message: Invalid indexed property
 
 Hi
 
 I am using logic:iterate tag as shown below
 
 logic:iterate id=element name=addRateForm   property=firstName
 indexId=i 
   tr
   % int j = ((Integer)
 pageContext.getAttribute(i)).intValue();  %
tdhtml:text name=addRateForm
 property=firstName[%=j%]/td
   
   /tr 
 /logic:iterate
 
 Error Message: Invalid indexed property  'firstName[]' 
 
 I did print the vlaues of j and they are fine. 
 
 
 What am i doing wrong in the above expression. 
 
 Thanks
 

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


RE: Error Message: Invalid indexed property

2003-06-11 Thread shirishchandra.sakhare
try..
html:text name=addRateForm property=%=\firstName[\+i+\]\%/

This way you dont need to create strings..

BTW, are u using struts 1.0?
Because with 1.1, you can directly use nested  tags..

-Original Message-
From: Sashi Ravipati [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 2:56 PM
To: [EMAIL PROTECTED]
Subject: RE: Error Message: Invalid indexed property


I tried that it works , but I have many HTML elements like that and I
would like to use 
html:text name=addRateForm  property=firstName[%=j%]/

so that I dont have to create different String objects.

Thanks


 [EMAIL PROTECTED] 06/11/03 08:57AM 
try like this
% String fname=firstName[+j+];%
  tdhtml:text name=addRateForm property=%=fname%/td
i didnt check it.pardon me if it doesn't work
Partha

 --
 From: Sashi Ravipati[SMTP:[EMAIL PROTECTED]
 Reply To: Struts Users Mailing List
 Sent: Wednesday, June 11, 2003 5:48 PM
 To: [EMAIL PROTECTED]
 Subject: Error Message: Invalid indexed property
 
 Hi
 
 I am using logic:iterate tag as shown below
 
 logic:iterate id=element name=addRateForm   property=firstName
 indexId=i 
   tr
   % int j = ((Integer)
 pageContext.getAttribute(i)).intValue();  %
tdhtml:text name=addRateForm
 property=firstName[%=j%]/td
   
   /tr 
 /logic:iterate
 
 Error Message: Invalid indexed property  'firstName[]' 
 
 I did print the vlaues of j and they are fine. 
 
 
 What am i doing wrong in the above expression. 
 
 Thanks
 

-
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]



RE: Error Message: Invalid indexed property

2003-06-11 Thread Sashi Ravipati
Thanks , it did the trick for me.



 [EMAIL PROTECTED] 06/11/03 09:00AM 
try..
html:text name=addRateForm property=%=\firstName[\+i+\]\%/

This way you dont need to create strings..

BTW, are u using struts 1.0?
Because with 1.1, you can directly use nested  tags..

-Original Message-
From: Sashi Ravipati [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 2:56 PM
To: [EMAIL PROTECTED]
Subject: RE: Error Message: Invalid indexed property


I tried that it works , but I have many HTML elements like that and I
would like to use 
html:text name=addRateForm  property=firstName[%=j%]/

so that I dont have to create different String objects.

Thanks


 [EMAIL PROTECTED] 06/11/03 08:57AM 
try like this
% String fname=firstName[+j+];%
  tdhtml:text name=addRateForm property=%=fname%/td
i didnt check it.pardon me if it doesn't work
Partha

 --
 From: Sashi Ravipati[SMTP:[EMAIL PROTECTED]
 Reply To: Struts Users Mailing List
 Sent: Wednesday, June 11, 2003 5:48 PM
 To: [EMAIL PROTECTED]
 Subject: Error Message: Invalid indexed property
 
 Hi
 
 I am using logic:iterate tag as shown below
 
 logic:iterate id=element name=addRateForm   property=firstName
 indexId=i 
   tr
   % int j = ((Integer)
 pageContext.getAttribute(i)).intValue();  %
tdhtml:text name=addRateForm
 property=firstName[%=j%]/td
   
   /tr 
 /logic:iterate
 
 Error Message: Invalid indexed property  'firstName[]' 
 
 I did print the vlaues of j and they are fine. 
 
 
 What am i doing wrong in the above expression. 
 
 Thanks
 

-
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]


Invalid indexed property ?!

2003-05-29 Thread Matthew Van Horn
I posted this before, but I didn't even get a response saying it was a  
dumb question, not worth answering, so I'll ask again because I am  
desperate.
I've got to finish this up soon, and I am stumped.
Again, sorry for the length - I just want to be clear.

I have a form that need to collect some information about a user, using  
checkbox groups like so:
Bourbon
[] Jim Beam
[] Makers Mark
[] Blantons

Scotch
[] Johnnie Walker
[] Macallan
[] Lagavulin
Beer
[] Budweiser
[] Heineken
[] Duvel
Users can select 0 or more from each category, and I would like to use  
multibox to create the checkbox groups.
I created a HashMap of String[]s like so:
	public HashMap getDrinksList() {
		drinks = new HashMap();
		drinks.put(Bourbon, new String[]{Jim Beam,Makers  
Mark,Blantons});
		drinks.put(Scotch,  new String[]{Johnnie  
Walker,Macallan,Lagavulin});
		drinks.put(Beer,new String[]{Budweiser,Heineken,Duvel});
	}

In my ActionForm I have:
private HashMap drinkPrefs = getDrinksList();
private String[] selectedDrinks;
public String[] getSelectedDrinks(String key) {
if(drinkPrefs.containsKey(key)) {
return (String[]) drinkPrefs.get(key);
} else {
return new String[]{};
}
}

public void setSelectedDrinks(String key, String[] selDrinks) {
  drinkPrefs.put(key, selDrinks) ;
}
In my jsp I have:
c:forEach var=drinkType items=${drinksList.keySet}!-- there is  
wrapper method for .keySet() --
	h3bean:write name=drinkType//h3
	c:forEach var=drinkItem items=${drinksList[drinkType]}
		html-el:multibox property=selectedDrinks[${drinkType}]
		bean:write name=drinkItem/
  		/html-el:multibox
   		bean:write name=drinkItem/
	  /c:forEach
/c:forEach

I would expect to get a list of checkbox groups like I laid out above,  
but instead I get:
java.lang.IllegalArgumentException: Invalid indexed property  
'selectedDrinks[Bourbon]' at  
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt 
ils.java:404)...etc etc.

What am I doing wrong? Where can I get more detailed information about  
multibox and indexed properties?

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


Re: Invalid indexed property ?!

2003-05-29 Thread Arron Bates
Instead of this tag...

html-el:multibox property=selectedDrinks[${drinkType}]

...try this one...

html-el:multibox property=selectedDrinks(${drinkType})

...basically the square breaces are for indexed properties. The round ones are
for maps. You're trying to drive a map based property, so use the round ones
instead. The JavaBean specification defines how these things should be done...
http://java.sun.com/products/javabeans/

Arron.


c:forEach var=drinkType items=${drinksList.keySet}
  !-- there is  
 wrapper method for .keySet() --
   h3bean:write name=drinkType//h3
   c:forEach var=drinkItem items=${drinksList[drinkType]}
   html-el:multibox property=selectedDrinks[${drinkType}]
   bean:write name=drinkItem/
   /html-el:multibox
   bean:write name=drinkItem/
 /c:forEach
 /c:forEach

 I posted this before, but I didn't even get a response saying it was a  
 dumb question, not worth answering, so I'll ask again because I am  
 desperate.
 I've got to finish this up soon, and I am stumped.
 Again, sorry for the length - I just want to be clear.
 
 I have a form that need to collect some information about a user, using  
 checkbox groups like so:
 Bourbon
 [] Jim Beam
 [] Makers Mark
 [] Blantons
 
 Scotch
 [] Johnnie Walker
 [] Macallan
 [] Lagavulin
 
 Beer
 [] Budweiser
 [] Heineken
 [] Duvel
 
 Users can select 0 or more from each category, and I would like to use  
 multibox to create the checkbox groups.
 I created a HashMap of String[]s like so:
   public HashMap getDrinksList() {
   drinks = new HashMap();
   drinks.put(Bourbon, new String[]{Jim Beam,Makers  
 Mark,Blantons});
   drinks.put(Scotch,  new String[]{Johnnie  
 Walker,Macallan,Lagavulin});
   drinks.put(Beer,new String[]{Budweiser,Heineken,Duvel});
   }

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



Indexed Property

2003-05-29 Thread Abhinav (Cognizant)
In order that my javascript validations run,
I can't have my html field names like name[0], name[1] ...
now I need to have multiple elements in my form with the same name. In this case 
though,
I wont be able to populate my form bean which has methods setName(int, String)/ 
getName(int) and attribute name[].

how should I go about it. I am sure someone must have faced a similar situation.

Thanx.

** Message from InterScan E-Mail VirusWall NT **

** No virus found in attached file noname.htm

No Virus detected in the attached file(s).
* End of message ***


This e-mail and any files transmitted with it are for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. If you are not 
the 
intended recipient, please contact the sender by reply e-mail and destroy all copies 
of 
the original message. 
Any unauthorised review, use, disclosure, dissemination, forwarding, printing or 
copying 
of this email or any action taken in reliance on this e-mail is strictly prohibited 
and 
may be unlawful.

  Visit us at http://www.cognizant.com

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

Re: Invalid indexed property ?!

2003-05-29 Thread Matthew Van Horn
Thank you! Thank you! Thank you!

Now, I must go slam my head into the desk a few times for not figuring 
that out myself. I recall seeing somewhere the the dot, and both sets 
of braces were equivalent, and it stuck in my head. I'll try to find it 
to see if it should be corrected.

On Thursday, May 29, 2003, at 03:39 PM, Arron Bates wrote:

From: Arron Bates [EMAIL PROTECTED]
Date: Thu May 29, 2003  3:39:22 PM Asia/Tokyo
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Re: Invalid indexed property ?!
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
Instead of this tag...

html-el:multibox property=selectedDrinks[${drinkType}]

...try this one...

html-el:multibox property=selectedDrinks(${drinkType})

...basically the square breaces are for indexed properties. The round 
ones are
for maps. You're trying to drive a map based property, so use the 
round ones
instead. The JavaBean specification defines how these things should be 
done...
http://java.sun.com/products/javabeans/

Arron.


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


Setting and Getting indexed property

2003-03-26 Thread Ritesh Singhal
Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

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



RE: Setting and Getting indexed property

2003-03-26 Thread shirishchandra.sakhare
U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]



RE: Setting and Getting indexed property

2003-03-26 Thread Ritesh Singhal
I couldn't find anything in the mailing list. Actually I am new to this
group. Do you know any resources on the internet where using indexed
property and lazy intialization is explained.

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]


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



RE: Setting and Getting indexed property

2003-03-26 Thread shirishchandra.sakhare
look at the following message in the archive...


http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:55 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I couldn't find anything in the mailing list. Actually I am new to this
group. Do you know any resources on the internet where using indexed
property and lazy intialization is explained.

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]


-
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]



RE: Setting and Getting indexed property

2003-03-26 Thread Ritesh Singhal
I think that helps. But you were talking something about Lazy
initialization. What is that?
Thanks and Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 7:09 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


look at the following message in the archive...


http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:55 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I couldn't find anything in the mailing list. Actually I am new to this
group. Do you know any resources on the internet where using indexed
property and lazy intialization is explained.

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]


-
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]


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



RE: Setting and Getting indexed property

2003-03-26 Thread shirishchandra.sakhare
Check the indexed getters n Form...If the beanList in form is empty,The beans are 
added as required when getter is called..
I was referring to this...

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 3:01 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I think that helps. But you were talking something about Lazy
initialization. What is that?
Thanks and Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 7:09 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


look at the following message in the archive...


http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:55 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I couldn't find anything in the mailing list. Actually I am new to this
group. Do you know any resources on the internet where using indexed
property and lazy intialization is explained.

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]


-
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]


-
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]



RE: Setting and Getting indexed property

2003-03-26 Thread Ritesh Singhal
In some of the mails I saw people using ListUtils.lazyList() from
commons library. I think that does the same what u r doing. Or I am not
getting it right and it means something else?

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 7:37 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


Check the indexed getters n Form...If the beanList in form is empty,The
beans are added as required when getter is called.. I was referring to
this...

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 3:01 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I think that helps. But you were talking something about Lazy
initialization. What is that? Thanks and Regards Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 7:09 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


look at the following message in the archive...


http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:55 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I couldn't find anything in the mailing list. Actually I am new to this
group. Do you know any resources on the internet where using indexed
property and lazy intialization is explained.

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]


-
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]


-
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]


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



RE: Setting and Getting indexed property

2003-03-26 Thread shirishchandra.sakhare
u are right..


-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 3:24 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


In some of the mails I saw people using ListUtils.lazyList() from
commons library. I think that does the same what u r doing. Or I am not
getting it right and it means something else?

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 7:37 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


Check the indexed getters n Form...If the beanList in form is empty,The
beans are added as required when getter is called.. I was referring to
this...

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 3:01 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I think that helps. But you were talking something about Lazy
initialization. What is that? Thanks and Regards Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 7:09 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


look at the following message in the archive...


http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:55 PM
To: Struts Users Mailing List
Subject: RE: Setting and Getting indexed property


I couldn't find anything in the mailing list. Actually I am new to this
group. Do you know any resources on the internet where using indexed
property and lazy intialization is explained.

Regards
Ritesh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 26, 2003 6:06 PM
To: [EMAIL PROTECTED]
Subject: RE: Setting and Getting indexed property


U need to use lazy initialiszation.
Search the mail archive...I had replied some similar mail...

regards,
Shirish

-Original Message-
From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Setting and Getting indexed property


Hi All,

I am having problem setting and getting indexed property of a form bean.
I have a form bean:

public class ExampleForm extends ActionForm {
private String id[];
private String name[];
private String address[];

public String getIdIndexed( int index )
{
return ( id[index] );
}


public void setIdIndexed(int index, String value)
{
id[index] = value;
}
. And so on
}

With appropriate getter and setter methods.

Now in my jsp page I am trying to access these fields and display them
in a table format. Something like this:

logic:iterate id=foo name=exampleForm property=id indexId=ctr
tr align=center valign=middle
tdhtml:text name=exampleForm property='%= idIndexed[
+ ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
nameIndexed[ + ctr + ]%'//td
tdhtml:text name=exampleForm property='%=
addressIndexed[ + ctr + ]%'//td
/tr
/logic:iterate

I want to have the same form bean for create and edit page of the
entity. So in create page I will have a table with blank fields and in
edit page I will have prepopulated fields. Also in edit page I shud be
able add more rows for the table. Now I don't know what property name to
give in create page of the entity. Above code works fine when form bean
is already populated, but problem comes when you want to create the
entity. Do I need to initialize the array? And of what size? As I want
it to be dynamic. Also in create page I want some default number of rows
with blank pages. What shud be the property name for those text fields?

Please help me. I am stuck coz of this problem.

Thanks and Regards
Ritesh

-
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]


-
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]


-
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

RE: Setting and Getting indexed property

2003-03-26 Thread gaffer
Ritesh,

Check the example at www.keyboardmonkey.com or the nested tag lib in
Struts. It may help with the presentation. Though, if you add an object
and need to save to a DB, you will likely need to use a lazyList.

Regards
Al

On Wed, 2003-03-26 at 06:24, Ritesh Singhal wrote:
 In some of the mails I saw people using ListUtils.lazyList() from
 commons library. I think that does the same what u r doing. Or I am not
 getting it right and it means something else?
 
 Regards
 Ritesh
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 26, 2003 7:37 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Setting and Getting indexed property
 
 
 Check the indexed getters n Form...If the beanList in form is empty,The
 beans are added as required when getter is called.. I was referring to
 this...
 
 -Original Message-
 From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 26, 2003 3:01 PM
 To: Struts Users Mailing List
 Subject: RE: Setting and Getting indexed property
 
 
 I think that helps. But you were talking something about Lazy
 initialization. What is that? Thanks and Regards Ritesh
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 26, 2003 7:09 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Setting and Getting indexed property
 
 
 look at the following message in the archive...
 
 
 http://marc.theaimsgroup.com/?l=struts-userm=104815589928698w=2
 
 -Original Message-
 From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 26, 2003 1:55 PM
 To: Struts Users Mailing List
 Subject: RE: Setting and Getting indexed property
 
 
 I couldn't find anything in the mailing list. Actually I am new to this
 group. Do you know any resources on the internet where using indexed
 property and lazy intialization is explained.
 
 Regards
 Ritesh
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 26, 2003 6:06 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Setting and Getting indexed property
 
 
 U need to use lazy initialiszation.
 Search the mail archive...I had replied some similar mail...
 
 regards,
 Shirish
 
 -Original Message-
 From: Ritesh Singhal [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 26, 2003 1:04 PM
 To: Struts Users Mailing List
 Subject: Setting and Getting indexed property
 
 
 Hi All,
 
 I am having problem setting and getting indexed property of a form bean.
 I have a form bean:
 
 public class ExampleForm extends ActionForm {
 private String id[];
 private String name[];
 private String address[];
 
 public String getIdIndexed( int index )
 {
 return ( id[index] );
 }
 
 
 public void setIdIndexed(int index, String value)
 {
 id[index] = value;
 }
 . And so on
 }
 
 With appropriate getter and setter methods.
 
 Now in my jsp page I am trying to access these fields and display them
 in a table format. Something like this:
 
 logic:iterate id=foo name=exampleForm property=id indexId=ctr
 tr align=center valign=middle
 tdhtml:text name=exampleForm property='%= idIndexed[
 + ctr + ]%'//td
 tdhtml:text name=exampleForm property='%=
 nameIndexed[ + ctr + ]%'//td
 tdhtml:text name=exampleForm property='%=
 addressIndexed[ + ctr + ]%'//td
 /tr
 /logic:iterate
 
 I want to have the same form bean for create and edit page of the
 entity. So in create page I will have a table with blank fields and in
 edit page I will have prepopulated fields. Also in edit page I shud be
 able add more rows for the table. Now I don't know what property name to
 give in create page of the entity. Above code works fine when form bean
 is already populated, but problem comes when you want to create the
 entity. Do I need to initialize the array? And of what size? As I want
 it to be dynamic. Also in create page I want some default number of rows
 with blank pages. What shud be the property name for those text fields?
 
 Please help me. I am stuck coz of this problem.
 
 Thanks and Regards
 Ritesh
 
 -
 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]
 
 
 -
 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]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL

Stupid indexed property DynaActionForm problem/question

2003-03-19 Thread Ian Hunter
Before anyone flames me, I have read through the archive, and as someone
already said, there is info in there, but no concrete basic examples.

Here's the formBean I'm trying to handle:

form-bean name=familyForm
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=address type=java.lang.String/
  form-property name=city type=java.lang.String/
  form-property name=state type=java.lang.String/
  form-property name=zip type=java.lang.String/
  form-property name=homePhone type=java.lang.String/
  form-property name=status type=java.lang.String/
  form-property name=firstName type=java.lang.String[]/
  form-property name=lastName type=java.lang.String[]/
  form-property name=cellPhone type=java.lang.String[]/
/form-bean

In short, there are some fields that are the same for everyone, and some
fields that are unique to each person.  I can place a hard limit on how many
firstNames there can be, but I want the code to refer to a constant
somewhere, say Constants.MAXPEOPLE or something.  I'm not trying to have
an array of some object type (there WAS somewhat of an example for that in
the archive), just flat out strings.

I know the JSP will look something like:

html:form action=saveFamily
html:text property=address/
html:text property=city/
html:text property=state/
html:text property=zip/
html:text property=homePhone/
html:text property=status/
logic:iterate ?
html:input ???/ for firstName
html:input ???/ for lastName
html:input ???/ for cellPhone
/logic:iterate
html:submit/
/html:form

Then from my actions I can do this:

DynaActionForm dynaForm = (DynaActionForm) form;
address = dynaForm.get(address).toString();
city = dynaForm.get(city).toString();
state = dynaForm.get(state).toString();
zip = dynaForm.get(zip).toString();
homePhone = dynaForm.get(homePhone).toString();
status = dynaForm.get(status).toString();
for (int i = 0; i  ???; i++) {
thisFirstName = dynaForm.get(firstName, i).toString();
thisLastName = dynaForm.get(lastName, i).toString();
thisCellPhone = dynaForm.get(cellPhone, i).toString();
}

Can someone fill in the ??, so to speak?




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



How rto set and get indexed property in jsp page

2003-03-14 Thread shashi_struts
Hi

I am not able to set and get the indexed property in jsp file.

Please Help Me

Regards

Shashi



Iterate + indexed property arghhh....

2003-03-03 Thread Jonathan
Hello,
 
I wonder whether somebody can help, I'm using the logic iterate tag to
loop through a number
of items producing a delete button for each of the items.  When the
delete button is
clicked I want to delete that particular item.  Using the below:
 
html:submit indexed='true'  onclick=return confirm('Confirm
Delete?');  property='action'
bean:message key=questionoption.button.delete/

/html:submit  
 
I produce a list of buttons which SHOULD appear like follows:
 
input type=submit name=action[0] value=Delete
input type=submit name=action[1] value=Delete
input type=submit name=action[2] value=Delete
 
but instead the name appears like this:
 
input type=submit name=action[0]  value=Delete   
 
With [0] being outside the bracket.
 
Can anybody tell me why this is?  Does it make a difference if I use '
to enclose the values
or whether I use  to enclose the values.  It would seem that it does so
does anybody know
the EXACT syntax for specifying a HTML submit button?  Should I be using
a nested:submit
component?  Does that really make any difference?
 
Also on the server side how would I catch which button has been pressed?
I can't use:
 
String action = (String)request.getParameter(action);
 
Because the index causes a problem,
 
Many thanks in advance for any help or tips you can provide me with,
this seems to be the last
part of my problems.
 
Jon.
 
*-*
 Jonathan Holloway,   
 Dept. Of Computer Science,   
 Aberystwyth University, 
 Ceredigion,  
 West Wales,  
 SY23 3DV.
  
 07968 902140 
 http://users.aber.ac.uk/jph8 
*-*
 


RE: indexed property

2003-02-27 Thread Mohan Radhakrishnan
Hi,
   
  Answering my own question :-\

 bean:define id=enddate name=reportForm property='%=
endDateIndexed[ + 0 + ] %'/
 html:text property=endDate styleClass=dropdown maxlength=10
size=12 value=%=enddate.toString()% 

  This seems to work.

Mohan


-Original Message-
From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 12:02 PM
To: 'Struts Users Mailing List'
Subject: indexed property


Hi,
  Can html:text directly accept an indexed property with struts 1.x ?
Mohan

-
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]



problems with nested indexed property

2003-02-27 Thread Ruud Steeghs
When I'm trying to submit the following form,
something funny happens. 
The subprocess.name property is set, but the indexed
properties are not set. The indexed properties
(subproces.subprocesList.starttime and s.s.endtime)
are set to their initial values; the request
parameters are not copied properly into the
ActionForm.
The appropriate getters and setters are provided in
the ActionForm and Subprocess-class.

Anyone have any idea what might cause this problem?

html:form action=savesubprocess.do
html:text property=subprocess.name /
nested:iterate property=subprocess.subprocesList
  startijd: nested:text property=starttime /
  eindtijd: nested:text property=eindtime /br
/nested:iterate
/html:form

Cheers,
Ruud.



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



RE: indexed property

2003-02-27 Thread Mark
I thought because Struts uses BeanUtils that it would have been able to figure this 
out for you byusing


html:text property=endDateIndex[0]/

You cant do this:

html:text property=endDateIndex value=endDateIndex[0]/

because struts treats whatever is in the value parameter as a literal, and does not 
perform a lookup.

Because the TextTag uses RequestUtils.Lookup method to lookup the property which in 
turn, uses the very nifty BeanUtils from commons to find the value from our array 
based form property.

Now, BeanUtils offers us some cool functionality:

http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/PropertyUtils.html

Indexed (name[index]) - The underlying property value is assumed to be an array, or 
this JavaBean is assumed to have indexed property getter and setter methods. The 
appropriate (zero-relative) entry in the array is selected. List objects are now also 
supported for read/write. You simply need to define a getter that returns the List 

Now, I dont know how this works in practice ;)

Good luck,
Mark


Hi,

  Answering my own question :-\

 bean:define id=enddate name=reportForm property='%=
endDateIndexed[ + 0 + ] %'/
 html:text property=endDate styleClass=dropdown maxlength=10
size=12 value=%=enddate.toString()%

  This seems to work.

Mohan


-Original Message-
From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 12:02 PM
To: 'Struts Users Mailing List'
Subject: indexed property


Hi,
  Can html:text directly accept an indexed property with struts 1.x ?
Mohan




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



RE: indexed property

2003-02-27 Thread Mohan Radhakrishnan
Hi,
 I was just trying to prevent dates being reset in a textbox.

 bean:define id=startdate name=form property='%=
startDateIndexed[ + 0 + ] %'/

   Since my form attributes were all String[] I use

public String getStartDateIndexed( int index ) {
return ( startDate_[ index ] );
}
and then I use

html:text property=startDate styleClass=dropdown maxlength=10
size=12 value=%=startdate.toString()%

 I do see exceptions with this.

org.apache.jasper.JasperException: Exception thrown by getter for property
startDateIndexed[0] of bean reportForm

My form starts with the following

private String[] startDate_ = new String[]{ 22/02/2002 };

Thanks,
Mohan

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]
Sent: Friday, February 28, 2003 9:33 AM
To: [EMAIL PROTECTED]
Subject: RE: indexed property


I thought because Struts uses BeanUtils that it would have been able to
figure this out for you byusing


html:text property=endDateIndex[0]/

You cant do this:

html:text property=endDateIndex value=endDateIndex[0]/ 

because struts treats whatever is in the value parameter as a literal, and
does not perform a lookup.

Because the TextTag uses RequestUtils.Lookup method to lookup the property
which in turn, uses the very nifty BeanUtils from commons to find the value
from our array based form property.

Now, BeanUtils offers us some cool functionality:

http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils
/PropertyUtils.html

Indexed (name[index]) - The underlying property value is assumed to be an
array, or this JavaBean is assumed to have indexed property getter and
setter methods. The appropriate (zero-relative) entry in the array is
selected. List objects are now also supported for read/write. You simply
need to define a getter that returns the List 

Now, I dont know how this works in practice ;)

Good luck,
Mark


Hi,
   
  Answering my own question :-\

 bean:define id=enddate name=reportForm property='%=
endDateIndexed[ + 0 + ] %'/
 html:text property=endDate styleClass=dropdown maxlength=10
size=12 value=%=enddate.toString()% 

  This seems to work.

Mohan


-Original Message-
From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 12:02 PM
To: 'Struts Users Mailing List'
Subject: indexed property


Hi,
  Can html:text directly accept an indexed property with struts 1.x ?
Mohan




-
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]



indexed property

2003-02-26 Thread Mohan Radhakrishnan
Hi,
  Can html:text directly accept an indexed property with struts 1.x ?
Mohan

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



Indexed property problem

2003-02-25 Thread Richard Kooijman
Hello,

I have a problem setting form properties that have a type of String[]. I have seen 
similar problems in other messages that came around, but now of them or their answers 
seem to address the specfic issue we encountered.

Somewhere in Struts (see stack trace below) the Array.set() method tries to fill in 
the String array using the indices from the form parameters of the submit request. The 
array that that method uses or gets passed has not been allocated to be able to hold 
the number of parameters we tries to pass on. In fact it is of String[0].

Somehow you would expect that either Struts of the DynaActionForm beans should make an 
extra step and pre-allocate the array before setting the individual array elements.
This does not seem to be done. 

My questions are:
- do we use the feature in the wrong manner?
- do we need to specify that array size somewhere, with which Struts can pre-allocate 
the array?
- did we stumble on a bug?

Any input appreciated,


Richard Kooijman

Here follows some details on this issue:

I have this defined in my struts-config.xml:

 form-bean dynamic=true name=soortopvanglocatieForm 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=vorm type=java.lang.String /
 form-property name=voorkeurenKinderdagverblijfVoorkeur 
type=java.lang.String[] /
 form-property 
name=voorkeurenBuitenschoolseopvangVoorkeur type=java.lang.String /
 form-property 
name=voorkeurenBuitenschoolseopvangBasisschool type=java.lang.String /
 form-property name=voorkeurenHalvedagopvangVoorkeur 
type=java.lang.String /

 /form-bean

Note the array of String as the type of voorkeurenKinderdagverblijfVoorkeur.

In my .jsp I have this:
logic:iterate id=voorkeur
name=soortopvanglocatieForm
property=voorkeurenKinderdagverblijfVoorkeur
indexId=i
html:text name=soortopvanglocatieForm 
property='%=voorkeurenKinderdagverblijfVoorkeur[ + i + ]%' size=20/
/logic:iterate

What happens is that the initial display of the page looks just fine. 
Things start to get messy when I essentially try to add or delete a 
html:text field (by trying to change the array of 
voorkeurenKinderdagverblijfVoorkeur in the background).
When I hit one of the two buttons I defined, Struts start parsing the 
POST information but halts in the bean populate() section:

java.lang.ArrayIndexOutOfBoundsException
at java.lang.reflect.Array.set(Native Method)
at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:457)
at 
org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.java:1414)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097)
at 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)

I debugged this in the source and the array that is to be set by 
Array.set is of type String[0].
And the particular instance that is being set is at index 1.
Anyway, it seems that the array properties in the DynaValidatorForm we 
are using aren't being allocated.

Any ideas or hints?

We use Struts 1.1b3, bean-utils 1.6.1.


Regards, Richard.


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



RE: Indexed property problem

2003-02-25 Thread Brandon Goodin
In the commons-collections use ListUtils.LazyList to initialize a list in
the bean.

Brandon Goodin
Phase Web and Multimedia
PO Box 85
Whitefish MT 59937
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws


-Original Message-
From: Richard Kooijman [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 25, 2003 1:56 PM
To: [EMAIL PROTECTED]
Subject: Indexed property problem


Hello,

I have a problem setting form properties that have a type of String[]. I
have seen similar problems in other messages that came around, but now of
them or their answers seem to address the specfic issue we encountered.

Somewhere in Struts (see stack trace below) the Array.set() method tries to
fill in the String array using the indices from the form parameters of the
submit request. The array that that method uses or gets passed has not been
allocated to be able to hold the number of parameters we tries to pass on.
In fact it is of String[0].

Somehow you would expect that either Struts of the DynaActionForm beans
should make an extra step and pre-allocate the array before setting the
individual array elements.
This does not seem to be done.

My questions are:
- do we use the feature in the wrong manner?
- do we need to specify that array size somewhere, with which Struts can
pre-allocate the array?
- did we stumble on a bug?

Any input appreciated,


Richard Kooijman

Here follows some details on this issue:

I have this defined in my struts-config.xml:

 form-bean dynamic=true name=soortopvanglocatieForm
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=vorm type=java.lang.String /
 form-property name=voorkeurenKinderdagverblijfVoorkeur
type=java.lang.String[] /
 form-property
name=voorkeurenBuitenschoolseopvangVoorkeur type=java.lang.String /
 form-property
name=voorkeurenBuitenschoolseopvangBasisschool type=java.lang.String /
 form-property name=voorkeurenHalvedagopvangVoorkeur
type=java.lang.String /

 /form-bean

Note the array of String as the type of voorkeurenKinderdagverblijfVoorkeur.

In my .jsp I have this:
logic:iterate id=voorkeur
name=soortopvanglocatieForm
property=voorkeurenKinderdagverblijfVoorkeur
indexId=i
html:text name=soortopvanglocatieForm
property='%=voorkeurenKinderdagverblijfVoorkeur[ + i + ]%' size=20/
/logic:iterate

What happens is that the initial display of the page looks just fine.
Things start to get messy when I essentially try to add or delete a
html:text field (by trying to change the array of
voorkeurenKinderdagverblijfVoorkeur in the background).
When I hit one of the two buttons I defined, Struts start parsing the
POST information but halts in the bean populate() section:

java.lang.ArrayIndexOutOfBoundsException
at java.lang.reflect.Array.set(Native Method)
at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:457)
at
org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.
java:1414)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j
ava:798)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)

I debugged this in the source and the array that is to be set by
Array.set is of type String[0].
And the particular instance that is being set is at index 1.
Anyway, it seems that the array properties in the DynaValidatorForm we
are using aren't being allocated.

Any ideas or hints?

We use Struts 1.1b3, bean-utils 1.6.1.


Regards, Richard.


-
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]



Indexed property problem

2003-02-21 Thread Richard Kooijman
Hello,

I have a problem setting form properties that have a type of String[].

I have this defined in my struts-config.xml:

 form-bean dynamic=true name=soortopvanglocatieForm 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=vorm type=java.lang.String /
 form-property name=voorkeurenKinderdagverblijfVoorkeur 
type=java.lang.String[] /
 form-property 
name=voorkeurenBuitenschoolseopvangVoorkeur type=java.lang.String /
 form-property 
name=voorkeurenBuitenschoolseopvangBasisschool type=java.lang.String /
 form-property name=voorkeurenHalvedagopvangVoorkeur 
type=java.lang.String /

 /form-bean

Note the array of String as the type of voorkeurenKinderdagverblijfVoorkeur.

In my .jsp I have this:
logic:iterate id=voorkeur
name=soortopvanglocatieForm
property=voorkeurenKinderdagverblijfVoorkeur
indexId=i
html:text name=soortopvanglocatieForm 
property='%=voorkeurenKinderdagverblijfVoorkeur[ + i + ]%' size=20/
/logic:iterate

What happens is that the initial display of the page looks just fine. 
Things start to get messy when I essentially try to add or delete a 
html:text field (by trying to change the array of 
voorkeurenKinderdagverblijfVoorkeur in the background).
When I hit one of the two buttons I defined, Struts start parsing the 
POST information but halts in the bean populate() section:

java.lang.ArrayIndexOutOfBoundsException
at java.lang.reflect.Array.set(Native Method)
at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:457)
at 
org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.java:1414)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097)
at 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)

I debugged this in the source and the array that is to be set by 
Array.set is of type String[0].
And the particular instance that is being set is at index 1.
Anyway, it seems that the array properties in the DynaValidatorForm we 
are using aren't being allocated.

Any ideas or hints?

We use Struts 1.1b3, bean-utils 1.6.1.


Regards, Richard.


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




Re: [Validator] indexed property validation

2003-02-05 Thread Vic Cekvenich
Yes!
Vic


Brandon Goodin wrote:

Can Validator validate indexed properties.

For example:

html:text property=element[0].value value=1/
html:text property=element[1].value value=bar/
html:text property=element[2].value value=foobar/

How could I make sure that element[0].value validates to an integer and then
validate element[1].value and make sure it contains an alpha-based entry.
So, in other words... Can I validate different indexes of a property with
different Validation rules? Can I even validate an indexed property?

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws




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




Re: [Validator] indexed property validation

2003-02-05 Thread Vic Cekvenich
Yes!
Vic

Brandon Goodin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Can Validator validate indexed properties.

 For example:

 html:text property=element[0].value value=1/
 html:text property=element[1].value value=bar/
 html:text property=element[2].value value=foobar/

 How could I make sure that element[0].value validates to an integer and
then
 validate element[1].value and make sure it contains an alpha-based entry.
 So, in other words... Can I validate different indexes of a property with
 different Validation rules? Can I even validate an indexed property?

 Brandon Goodin
 Phase Web and Multimedia
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws




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




[OT] RE: [Validator] indexed property validation

2003-02-05 Thread Guptill, Josh
Is your email program broken?  Or do you just like to send duplicate
messages?

-Original Message-
From: Vic Cekvenich [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 03, 2003 5:58 PM
To: [EMAIL PROTECTED]
Subject: Re: [Validator] indexed property validation


Yes!
Vic

Brandon Goodin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Can Validator validate indexed properties.

 For example:

 html:text property=element[0].value value=1/
 html:text property=element[1].value value=bar/
 html:text property=element[2].value value=foobar/

 How could I make sure that element[0].value validates to an integer and
then
 validate element[1].value and make sure it contains an alpha-based entry.
 So, in other words... Can I validate different indexes of a property with
 different Validation rules? Can I even validate an indexed property?

 Brandon Goodin
 Phase Web and Multimedia
 P (406) 862-2245
 F (406) 862-0354
 [EMAIL PROTECTED]
 http://www.phase.ws




-
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]




[Validator] indexed property validation

2003-02-01 Thread Brandon Goodin

Can Validator validate indexed properties.

For example:

html:text property=element[0].value value=1/
html:text property=element[1].value value=bar/
html:text property=element[2].value value=foobar/

How could I make sure that element[0].value validates to an integer and then
validate element[1].value and make sure it contains an alpha-based entry.
So, in other words... Can I validate different indexes of a property with
different Validation rules? Can I even validate an indexed property?

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
[EMAIL PROTECTED]
http://www.phase.ws



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




Indexed property

2003-01-07 Thread Yujin Kim
Hello,

I understand this topic has been discussed before, so I apologize for
posting this again.
Using strtus 1.1-b3, I'm creating a form bean that contains a
collection(ArrayList) and use it to populate the jsp using the iterate
tag.  With or without indexed attribute in the form elements (i.e
html:text  Indexed=true), I got the jsp to populate the data.
My problem is mostly in the action class where the form gets submitted.

If I don't set indexed=true, then the jsp is populated correctly. But
when the submit button is clicked, the the collection is always set to
null.

If I set indexed=true, and if I put indexed getter and setter methods
along with regular getter and setter for the collection, I would get No
getter method for property error when jsp is created.

If I set indexed=true, and if I don't have indexed getter and setter,
then jsp is created fine with correct indexed form field name, etc but I
would get java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 error
on submit.

I've been struggling with this issue since yesterday, and I'm running
out of ideas now.

Any comments would be greatly appreciated.  
(And hopefully I described my problem for you to understand.)

Yujin

P.S: my apologies for not posting the sourcecode.  I don't want to post
it as is, and I'm a bit tight on time to meet the deadline, so I didn't
want to spend too much time on reformatting the source code I have.  I
would send it out if any of you think it's necessary.



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




RE: Indexed property

2003-01-07 Thread pqin
Override reset method in your ActionForm

Regards,
 
 
PQ
 
This Guy Thinks He Knows Everything
This Guy Thinks He Knows What He Is Doing

-Original Message-
From: Yujin Kim [mailto:[EMAIL PROTECTED]] 
Sent: January 7, 2003 1:21 PM
To: 'Struts Users Mailing List'
Subject: Indexed property

Hello,

I understand this topic has been discussed before, so I apologize for
posting this again.
Using strtus 1.1-b3, I'm creating a form bean that contains a
collection(ArrayList) and use it to populate the jsp using the iterate
tag.  With or without indexed attribute in the form elements (i.e
html:text  Indexed=true), I got the jsp to populate the data.
My problem is mostly in the action class where the form gets submitted.

If I don't set indexed=true, then the jsp is populated correctly. But
when the submit button is clicked, the the collection is always set to
null.

If I set indexed=true, and if I put indexed getter and setter methods
along with regular getter and setter for the collection, I would get No
getter method for property error when jsp is created.

If I set indexed=true, and if I don't have indexed getter and setter,
then jsp is created fine with correct indexed form field name, etc but I
would get java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 error
on submit.

I've been struggling with this issue since yesterday, and I'm running
out of ideas now.

Any comments would be greatly appreciated.  
(And hopefully I described my problem for you to understand.)

Yujin

P.S: my apologies for not posting the sourcecode.  I don't want to post
it as is, and I'm a bit tight on time to meet the deadline, so I didn't
want to spend too much time on reformatting the source code I have.  I
would send it out if any of you think it's necessary.



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



RE: Indexed property

2003-01-07 Thread Alok Pota
Welcome to the club.

I have attached three files (1 jsp, 1 action class and 1 form class).
Note that I am trying to dynamically add/delete key-value pairs on the
web-page and this how I used struts to do it
The example won't work but I have gave u the relevant code for you to zoom
into.




-Original Message-
From: Yujin Kim [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 12:21 PM
To: 'Struts Users Mailing List'
Subject: Indexed property


Hello,

I understand this topic has been discussed before, so I apologize for
posting this again.
Using strtus 1.1-b3, I'm creating a form bean that contains a
collection(ArrayList) and use it to populate the jsp using the iterate
tag.  With or without indexed attribute in the form elements (i.e
html:text  Indexed=true), I got the jsp to populate the data.
My problem is mostly in the action class where the form gets submitted.

If I don't set indexed=true, then the jsp is populated correctly. But
when the submit button is clicked, the the collection is always set to
null.

If I set indexed=true, and if I put indexed getter and setter methods
along with regular getter and setter for the collection, I would get No
getter method for property error when jsp is created.

If I set indexed=true, and if I don't have indexed getter and setter,
then jsp is created fine with correct indexed form field name, etc but I
would get java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 error
on submit.

I've been struggling with this issue since yesterday, and I'm running
out of ideas now.

Any comments would be greatly appreciated.
(And hopefully I described my problem for you to understand.)

Yujin

P.S: my apologies for not posting the sourcecode.  I don't want to post
it as is, and I'm a bit tight on time to meet the deadline, so I didn't
want to spend too much time on reformatting the source code I have.  I
would send it out if any of you think it's necessary.



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




edit.jsp
Description: Binary data


ProcessAction.java
Description: Binary data


SubmitForm.java
Description: Binary data
--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


RE: Indexed property

2003-01-07 Thread Yujin Kim
PQ,

Thank you very much.  You made my day.
Thanks Alok for your sample codes as well.

Overriding the reset method, and modifying the getter method did the
trick for me.

Yujin

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 07, 2003 1:24 PM
To: [EMAIL PROTECTED]
Subject: RE: Indexed property


Override reset method in your ActionForm

Regards,
 
 
PQ
 
This Guy Thinks He Knows Everything
This Guy Thinks He Knows What He Is Doing

-Original Message-
From: Yujin Kim [mailto:[EMAIL PROTECTED]] 
Sent: January 7, 2003 1:21 PM
To: 'Struts Users Mailing List'
Subject: Indexed property

Hello,

I understand this topic has been discussed before, so I apologize for
posting this again.
Using strtus 1.1-b3, I'm creating a form bean that contains a
collection(ArrayList) and use it to populate the jsp using the iterate
tag.  With or without indexed attribute in the form elements (i.e
html:text  Indexed=true), I got the jsp to populate the data.
My problem is mostly in the action class where the form gets submitted.

If I don't set indexed=true, then the jsp is populated correctly. But
when the submit button is clicked, the the collection is always set to
null.

If I set indexed=true, and if I put indexed getter and setter methods
along with regular getter and setter for the collection, I would get No
getter method for property error when jsp is created.

If I set indexed=true, and if I don't have indexed getter and setter,
then jsp is created fine with correct indexed form field name, etc but I
would get java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 error
on submit.

I've been struggling with this issue since yesterday, and I'm running
out of ideas now.

Any comments would be greatly appreciated.  
(And hopefully I described my problem for you to understand.)

Yujin

P.S: my apologies for not posting the sourcecode.  I don't want to post
it as is, and I'm a bit tight on time to meet the deadline, so I didn't
want to spend too much time on reformatting the source code I have.  I
would send it out if any of you think it's necessary.



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



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




Prepopulating DynaActionForm which has an indexed property

2002-12-11 Thread Srinivas Bhagavathula

Hi,

I am reposting this question, did not get any input for my last post. Hope 
someone can give me some inputs here. thanks, srinivas


How can I prepopulate an DynaValidator/DynaAction form which has an  indexed 
property?

this is my form definition

form-bean name=myForm type=org.apache.struts.action.DynaActionForm
dynamic=true
form-property name=firstName type=java.lang.string[]/
form-property name=companyID type=java.lang.string/
/form-bean


Action class:

DynaBean newForm =
DynaActionFormClass.getDynaActionFormClass(myForm).newInstance
();

for (int i= 0; i  employee.numberofPersons() ; ++ i)
  newForm.set(firstName, i , employee.firstName();

newForm.set(companyID, 12345);
request.setAttribute(InfoForm, newForm);


The code breaks because it does not know the size of the firstName[] indexed 
property. I could have done this by using an initial property and set the 
size but the size changes dynamically. How can I set the size of the 
firstName property in the action class code (just before populating the 
property)


TIA,
srinivas





_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


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



RE: Prepopulating DynaActionForm which has an indexed property

2002-12-11 Thread Robert Taylor
 Try this:

 DynaBean newForm =
 DynaActionFormClass.getDynaActionFormClass(myForm).newInstance();
 String[] firstNames = new String[employee.numberOfPersons()];

 for (int i= 0; i  employee.numberofPersons() ; ++ i)
firstNames[i] = employee.firstName(); // do you mean
employee.firstName(i); ?

 newForm.set(firstName, firstNames);
 newForm.set(companyID, 12345);
 request.setAttribute(InfoForm, newForm);



HTH,

robert


 -Original Message-
 From: Srinivas Bhagavathula [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 11, 2002 8:54 AM
 To: [EMAIL PROTECTED]
 Subject: Prepopulating DynaActionForm which has an indexed property



 Hi,

 I am reposting this question, did not get any input for my last
 post. Hope
 someone can give me some inputs here. thanks, srinivas


 How can I prepopulate an DynaValidator/DynaAction form which has
 an  indexed
 property?

 this is my form definition

 form-bean name=myForm type=org.apache.struts.action.DynaActionForm
 dynamic=true
 form-property name=firstName type=java.lang.string[]/
 form-property name=companyID type=java.lang.string/
 /form-bean


 Action class:

 DynaBean newForm =
 DynaActionFormClass.getDynaActionFormClass(myForm).newInstance
 ();

 for (int i= 0; i  employee.numberofPersons() ; ++ i)
newForm.set(firstName, i , employee.firstName();

 newForm.set(companyID, 12345);
 request.setAttribute(InfoForm, newForm);


 The code breaks because it does not know the size of the
 firstName[] indexed
 property. I could have done this by using an initial property and set the
 size but the size changes dynamically. How can I set the size of the
 firstName property in the action class code (just before populating the
 property)


 TIA,
 srinivas





 _
 Tired of spam? Get advanced junk mail protection with MSN 8.
 http://join.msn.com/?page=features/junkmail


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


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




Re: Prepopulating DynaActionForm which has an indexed property

2002-12-11 Thread Mark
I'm doing the same kind of thing, I don't think dynaform supports arrays so
that might explain why it isn't digging what its being sent. The mapped
backed action form is the puppy you need to get your head 'round (as do i).

Read the latest docs on 'map backed action forms'.. This basically puts an
undefined amount of form values into a hash map. To the best of my knowledge
you don't define these fields in config.xml.

Cheers mark

On 11-12-2002 14:54, Srinivas Bhagavathula [EMAIL PROTECTED] wrote:

 
 Hi,
 
 I am reposting this question, did not get any input for my last post. Hope
 someone can give me some inputs here. thanks, srinivas
 
 
 How can I prepopulate an DynaValidator/DynaAction form which has an  indexed
 property?
 
 this is my form definition
 
 form-bean name=myForm type=org.apache.struts.action.DynaActionForm
 dynamic=true
 form-property name=firstName type=java.lang.string[]/
 form-property name=companyID type=java.lang.string/
 /form-bean
 
 
 Action class:
 
 DynaBean newForm =
 DynaActionFormClass.getDynaActionFormClass(myForm).newInstance
 ();
 
 for (int i= 0; i  employee.numberofPersons() ; ++ i)
  newForm.set(firstName, i , employee.firstName();
 
 newForm.set(companyID, 12345);
 request.setAttribute(InfoForm, newForm);
 
 
 The code breaks because it does not know the size of the firstName[] indexed
 property. I could have done this by using an initial property and set the
 size but the size changes dynamically. How can I set the size of the
 firstName property in the action class code (just before populating the
 property)
 
 
 TIA,
 srinivas
 
 
 
 
 
 _
 Tired of spam? Get advanced junk mail protection with MSN 8.
 http://join.msn.com/?page=features/junkmail
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 


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




RE: Prepopulating DynaActionForm which has an indexed property

2002-12-11 Thread Srinivas Bhagavathula
Thanks Robert!!! That worked...appreciate the help







From: Robert Taylor [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: Prepopulating DynaActionForm which has an indexed property
Date: Wed, 11 Dec 2002 09:21:11 -0500

 Try this:

 DynaBean newForm =
 DynaActionFormClass.getDynaActionFormClass(myForm).newInstance();
 String[] firstNames = new String[employee.numberOfPersons()];

 for (int i= 0; i  employee.numberofPersons() ; ++ i)
firstNames[i] = employee.firstName(); // do you mean
employee.firstName(i); ?

 newForm.set(firstName, firstNames);
 newForm.set(companyID, 12345);
 request.setAttribute(InfoForm, newForm);



HTH,

robert


 -Original Message-
 From: Srinivas Bhagavathula [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 11, 2002 8:54 AM
 To: [EMAIL PROTECTED]
 Subject: Prepopulating DynaActionForm which has an indexed property



 Hi,

 I am reposting this question, did not get any input for my last
 post. Hope
 someone can give me some inputs here. thanks, srinivas


 How can I prepopulate an DynaValidator/DynaAction form which has
 an  indexed
 property?

 this is my form definition

 form-bean name=myForm type=org.apache.struts.action.DynaActionForm
 dynamic=true
 form-property name=firstName type=java.lang.string[]/
 form-property name=companyID type=java.lang.string/
 /form-bean


 Action class:

 DynaBean newForm =
 DynaActionFormClass.getDynaActionFormClass(myForm).newInstance
 ();

 for (int i= 0; i  employee.numberofPersons() ; ++ i)
newForm.set(firstName, i , employee.firstName();

 newForm.set(companyID, 12345);
 request.setAttribute(InfoForm, newForm);


 The code breaks because it does not know the size of the
 firstName[] indexed
 property. I could have done this by using an initial property and set 
the
 size but the size changes dynamically. How can I set the size of the
 firstName property in the action class code (just before populating 
the
 property)


 TIA,
 srinivas





 _
 Tired of spam? Get advanced junk mail protection with MSN 8.
 http://join.msn.com/?page=features/junkmail


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


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


_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


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



Re: Prepopulating DynaActionForm which has an indexed property

2002-12-11 Thread Mark
I'm doing the same kind of thing, I don't think dynaform supports arrays so
that might explain why it isn't digging what its being sent. The mapped
backed action form is the puppy you need to get your head 'round (as do i).

Read the latest docs on 'map backed action forms'.. This basically puts an
undefined amount of form values into a hash map. To the best of my knowledge
you don't define these fields in config.xml.

Cheers mark

On 11-12-2002 14:54, Srinivas Bhagavathula [EMAIL PROTECTED] wrote:

 
 Hi,
 
 I am reposting this question, did not get any input for my last post. Hope
 someone can give me some inputs here. thanks, srinivas
 
 
 How can I prepopulate an DynaValidator/DynaAction form which has an  indexed
 property?
 
 this is my form definition
 
 form-bean name=myForm type=org.apache.struts.action.DynaActionForm
 dynamic=true
 form-property name=firstName type=java.lang.string[]/
 form-property name=companyID type=java.lang.string/
 /form-bean
 
 
 Action class:
 
 DynaBean newForm =
 DynaActionFormClass.getDynaActionFormClass(myForm).newInstance
 ();
 
 for (int i= 0; i  employee.numberofPersons() ; ++ i)
  newForm.set(firstName, i , employee.firstName();
 
 newForm.set(companyID, 12345);
 request.setAttribute(InfoForm, newForm);
 
 
 The code breaks because it does not know the size of the firstName[] indexed
 property. I could have done this by using an initial property and set the
 size but the size changes dynamically. How can I set the size of the
 firstName property in the action class code (just before populating the
 property)
 
 
 TIA,
 srinivas
 
 
 
 
 
 _
 Tired of spam? Get advanced junk mail protection with MSN 8.
 http://join.msn.com/?page=features/junkmail
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 


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




Prepopulating DynaActionForm which has an indexed property

2002-12-10 Thread Srinivas Bhagavathula

Hi,

How can I prepopulate an DynaValidator/DynaAction form which has an  indexed 
property?

this is my form definition

form-bean name=myForm type=org.apache.struts.action.DynaActionForm
dynamic=true
form-property name=firstName type=java.lang.string[]/
form-property name=companyID type=java.lang.string/
/form-bean


Action class:

DynaBean newForm =
DynaActionFormClass.getDynaActionFormClass(myForm).newInstance
();

for (int i= 0; i  employee.numberofPersons() ; ++ i)
   newForm.set(firstName, i , employee.firstName();

newForm.set(companyID, 12345);
request.setAttribute(InfoForm, newForm);


The code breaks because it does not know the size of the firstName[] indexed 
property. I could have done this by using an initial property and set the 
size but the size changes dynamically. How can I set the size of the 
firstName property in the action class code (just before populating the 
property)


TIA,
srinivas






_
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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



RE: Question - DynaActionForm and indexed property

2002-10-31 Thread Praful . Kapadia
Note: this will be this simple only if all your creditCard attributes are
Strings, otherwise you'll need to resort to PropertyUtils.copyProperties()
or some homegrown conversion method, I believe.

I have this problem. The attributes are not strings (and they have no useful 
toString() method).

How do I cope with that?

Thanks

Praful
 

-Original Message-
From: Taylor, Jason [mailto:jtaylor;cobaltgroup.com]
Sent: 25 October 2002 18:21
To: 'Struts Users Mailing List'
Subject: RE: Question - DynaActionForm and indexed property


If it's an ArrayList, you'd specify the type as java.util.ArrayList

-Original Message-
From: Andy Kriger [mailto:akriger;greaterthanone.com]
Sent: Friday, October 25, 2002 8:00 AM
To: Struts Users Mailing List
Subject: RE: Question - DynaActionForm and indexed property


does that type format of class[] apply to Arrays and Lists?

-Original Message-
From: Taylor, Jason [mailto:jtaylor;cobaltgroup.com]
Sent: Friday, October 25, 2002 10:42
To: 'Struts Users Mailing List'
Subject: RE: Question - DynaActionForm and indexed property


hope you're using struts 1.1-- you're going to need the indexed attribute.
Here's the basic idea:

logic:iterate id=creditCard name=myForm property=creditCards
Type: html:text name=creditCard property=type indexed=true /
Name: html:text name=creditCard property=name indexed=true /
...
/logic:iterate

and

form-bean name=myForm type=o.a.s.a.DynaActionForm
form-property name=creditCards type=com.ra.ic.model.CreditCard[] /
/form-bean

Note: this will be this simple only if all your creditCard attributes are
Strings, otherwise you'll need to resort to PropertyUtils.copyProperties()
or some homegrown conversion method, I believe.

-JT

-Original Message-
From: Andy Kriger [mailto:akriger;greaterthanone.com]
Sent: Friday, October 25, 2002 7:15 AM
To: Struts Users Mailing List
Subject: Question - DynaActionForm and indexed property


I am trying to setup a DynaActionForm to use indexed and named properties.
But I'm getting an error and, not knowing BeanUtils very well, I'm wondering
if someone can guide me in what I need to do to make this work.

In my form...
html:text property='creditCard[0].type' /
html:text property='creditCard[0].name' /
html:text property='creditCard[0].number' /
html:text property='creditCard[0].expDate' /

In my struts-config.xml...
form-property name='creditCard[0].type' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].name' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].number' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].expDate'
type='com.ra.ic.model.CreditCard' /

CreditCard has get/set methods for type, name, number, expDate.

The error I'm getting is...
javax.servlet.jsp.JspException:
No getter method for property creditCard[0].type of bean
org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:742)





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



--
To unsubscribe, e-mail:
mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail:
mailto: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:   mailto:struts-user-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org




RE: Question - DynaActionForm and indexed property

2002-10-25 Thread Taylor, Jason
hope you're using struts 1.1-- you're going to need the indexed attribute.
Here's the basic idea:

logic:iterate id=creditCard name=myForm property=creditCards
Type: html:text name=creditCard property=type indexed=true /
Name: html:text name=creditCard property=name indexed=true /
...
/logic:iterate

and

form-bean name=myForm type=o.a.s.a.DynaActionForm
form-property name=creditCards type=com.ra.ic.model.CreditCard[] /
/form-bean

Note: this will be this simple only if all your creditCard attributes are
Strings, otherwise you'll need to resort to PropertyUtils.copyProperties()
or some homegrown conversion method, I believe.

-JT

-Original Message-
From: Andy Kriger [mailto:akriger;greaterthanone.com]
Sent: Friday, October 25, 2002 7:15 AM
To: Struts Users Mailing List
Subject: Question - DynaActionForm and indexed property


I am trying to setup a DynaActionForm to use indexed and named properties.
But I'm getting an error and, not knowing BeanUtils very well, I'm wondering
if someone can guide me in what I need to do to make this work.

In my form...
html:text property='creditCard[0].type' /
html:text property='creditCard[0].name' /
html:text property='creditCard[0].number' /
html:text property='creditCard[0].expDate' /

In my struts-config.xml...
form-property name='creditCard[0].type' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].name' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].number' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].expDate'
type='com.ra.ic.model.CreditCard' /

CreditCard has get/set methods for type, name, number, expDate.

The error I'm getting is...
javax.servlet.jsp.JspException:
No getter method for property creditCard[0].type of bean
org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:742)





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



RE: Question - DynaActionForm and indexed property

2002-10-25 Thread Andy Kriger
does that type format of class[] apply to Arrays and Lists?

-Original Message-
From: Taylor, Jason [mailto:jtaylor;cobaltgroup.com]
Sent: Friday, October 25, 2002 10:42
To: 'Struts Users Mailing List'
Subject: RE: Question - DynaActionForm and indexed property


hope you're using struts 1.1-- you're going to need the indexed attribute.
Here's the basic idea:

logic:iterate id=creditCard name=myForm property=creditCards
Type: html:text name=creditCard property=type indexed=true /
Name: html:text name=creditCard property=name indexed=true /
...
/logic:iterate

and

form-bean name=myForm type=o.a.s.a.DynaActionForm
form-property name=creditCards type=com.ra.ic.model.CreditCard[] /
/form-bean

Note: this will be this simple only if all your creditCard attributes are
Strings, otherwise you'll need to resort to PropertyUtils.copyProperties()
or some homegrown conversion method, I believe.

-JT

-Original Message-
From: Andy Kriger [mailto:akriger;greaterthanone.com]
Sent: Friday, October 25, 2002 7:15 AM
To: Struts Users Mailing List
Subject: Question - DynaActionForm and indexed property


I am trying to setup a DynaActionForm to use indexed and named properties.
But I'm getting an error and, not knowing BeanUtils very well, I'm wondering
if someone can guide me in what I need to do to make this work.

In my form...
html:text property='creditCard[0].type' /
html:text property='creditCard[0].name' /
html:text property='creditCard[0].number' /
html:text property='creditCard[0].expDate' /

In my struts-config.xml...
form-property name='creditCard[0].type' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].name' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].number' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].expDate'
type='com.ra.ic.model.CreditCard' /

CreditCard has get/set methods for type, name, number, expDate.

The error I'm getting is...
javax.servlet.jsp.JspException:
No getter method for property creditCard[0].type of bean
org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:742)





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



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




RE: Question - DynaActionForm and indexed property

2002-10-25 Thread Taylor, Jason
If it's an ArrayList, you'd specify the type as java.util.ArrayList

-Original Message-
From: Andy Kriger [mailto:akriger;greaterthanone.com]
Sent: Friday, October 25, 2002 8:00 AM
To: Struts Users Mailing List
Subject: RE: Question - DynaActionForm and indexed property


does that type format of class[] apply to Arrays and Lists?

-Original Message-
From: Taylor, Jason [mailto:jtaylor;cobaltgroup.com]
Sent: Friday, October 25, 2002 10:42
To: 'Struts Users Mailing List'
Subject: RE: Question - DynaActionForm and indexed property


hope you're using struts 1.1-- you're going to need the indexed attribute.
Here's the basic idea:

logic:iterate id=creditCard name=myForm property=creditCards
Type: html:text name=creditCard property=type indexed=true /
Name: html:text name=creditCard property=name indexed=true /
...
/logic:iterate

and

form-bean name=myForm type=o.a.s.a.DynaActionForm
form-property name=creditCards type=com.ra.ic.model.CreditCard[] /
/form-bean

Note: this will be this simple only if all your creditCard attributes are
Strings, otherwise you'll need to resort to PropertyUtils.copyProperties()
or some homegrown conversion method, I believe.

-JT

-Original Message-
From: Andy Kriger [mailto:akriger;greaterthanone.com]
Sent: Friday, October 25, 2002 7:15 AM
To: Struts Users Mailing List
Subject: Question - DynaActionForm and indexed property


I am trying to setup a DynaActionForm to use indexed and named properties.
But I'm getting an error and, not knowing BeanUtils very well, I'm wondering
if someone can guide me in what I need to do to make this work.

In my form...
html:text property='creditCard[0].type' /
html:text property='creditCard[0].name' /
html:text property='creditCard[0].number' /
html:text property='creditCard[0].expDate' /

In my struts-config.xml...
form-property name='creditCard[0].type' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].name' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].number' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].expDate'
type='com.ra.ic.model.CreditCard' /

CreditCard has get/set methods for type, name, number, expDate.

The error I'm getting is...
javax.servlet.jsp.JspException:
No getter method for property creditCard[0].type of bean
org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:742)





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



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



Question - DynaActionForm and indexed property

2002-10-23 Thread Andy Kriger
I am trying to setup a DynaActionForm to use indexed and named properties.
But I'm getting an error and, not knowing BeanUtils very well, I'm wondering
if someone can guide me in what I need to do to make this work.

In my form...
html:text property='creditCard[0].type' /
html:text property='creditCard[0].name' /
html:text property='creditCard[0].number' /
html:text property='creditCard[0].expDate' /

In my struts-config.xml...
form-property name='creditCard[0].type' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].name' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].number' type='com.ra.ic.model.CreditCard'
/
form-property name='creditCard[0].expDate'
type='com.ra.ic.model.CreditCard' /

CreditCard has get/set methods for type, name, number, expDate.

The error I'm getting is...
javax.servlet.jsp.JspException:
No getter method for property creditCard[0].type of bean
org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:742)





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




problem getting indexed property values

2002-09-25 Thread Matt Sales

Hello,
I'm having a hard time getting the value of an indexed property to my Action
classes.

Essentially, on my JSP I've got

html:select property=nestedClass.nestedBeans[x].value size=1
html:options ... /
/html:select

where nestedClass is (of course) a nested class within my ActionForm class,
and nestedBeans is an array of beans with an attribute value.

What's perplexing to me is that the correct values are coming up in my JSP
page (so my syntax must be correct).  After I submit the form, though, every
bean in nestedBeans is reset to 'null'.  I have a custom reset function in
the ActionForm, and it does not reset nestedClass or any of it's values.
Has anyone run into similar problems?

I can include code if it would help.

Thanks in advance,
Matt


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




RE: problem getting indexed property values

2002-09-25 Thread Taylor, Jason

if you *really* want to do it this way, you need to have an embedded
scriptlet:

html:select property=nestedClass.nestedBeans[%
request.getParameter(index) %].value size=1

or something like that

better is to refer to a unique property of the action form which is the
selected item, and a collection that houses a copy of the list of objects
that possess the property like this:
html:select name=nestedClass property=nestedBeanValue
html:options collection=nestedBeans property=value
labelProperty=label/
/html:select
if you're wedded to index, make it a property of your objects in the list

-JT

-Original Message-
From: Matt Sales [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 10:27 AM
To: Struts Users Mailing List
Subject: problem getting indexed property values


Hello,
I'm having a hard time getting the value of an indexed property to my Action
classes.

Essentially, on my JSP I've got

html:select property=nestedClass.nestedBeans[x].value size=1
html:options ... /
/html:select

where nestedClass is (of course) a nested class within my ActionForm class,
and nestedBeans is an array of beans with an attribute value.

What's perplexing to me is that the correct values are coming up in my JSP
page (so my syntax must be correct).  After I submit the form, though, every
bean in nestedBeans is reset to 'null'.  I have a custom reset function in
the ActionForm, and it does not reset nestedClass or any of it's values.
Has anyone run into similar problems?

I can include code if it would help.

Thanks in advance,
Matt


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



RE: Nested Indexed Property

2002-09-22 Thread Taylor, Jason

OK, I think I see what you're trying to do better now.  Email really is one
of the worst possible ways to discuss things of technical subtlety, but it's
all we got, so patience and careful reading is sometimes required...


Instead of trying to generate a list of objects with a logic:iterate that
are then sent as request parameters to the Action and used by the controller
to populate the ActionForm, you seem to be trying to refer to an index on a
list of objects that exists already.  If I'm wrong, then let me know and
I'll suggest something else.  Otherwise, I have the following
thoughts/suggestions:


You may want to refer to some unique identifier rather than using the array
index.  Or make the index a property of the object which is essentially the
same thing.

That way, you can do things like use html:select to specify the value of
the identifier, and html:options to specify the collection of objects.  

In your case, you'd select a customer id/index on the first page which would
correspond to the property used by the html:select on the second.  The
collection used by html:options is your array of customers.  

What I guess I don't get is why you need to refer to an array when you're
editing fields in the customer object the user selected.  Why not just have
the user select a single object from the array, and have that object be a
form bean that you then compare to the corresponding object in the array
once the user has submitted the form?  That way, you're not in the business
of selecting and editing simultaneously.

If the reason is that the array of customers we're talking about here is
actually your object model, you may want to think about the way your
application is using the form (ignore the rest of this paragraph if that's
not the reason).  Usually, it's better to have the FormBeans be copies of
the model objects so that you can have a sort of validating DMZ protecting
your data-- if you don't agree, poke around and you're sure to find a rant
by Craig McC that explains it better than I'm able.  The basic idea is to
keep the M and the V in MVC separate.

HTH,

-JT

-Original Message-
From: Howard Miller [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 3:38 PM
To: Struts Users Mailing List
Subject: RE: Nested Indexed Property


More experimentation.

Taking your example, what I would *like* to write is

html:text property=customer[%= request.getParameter(index) %].name /

where the parameter index comes from the user selection on the previous
page. 
Doesn't compile though!! Is there a way of writing the above that will
compile?

HM

On 21 Sep 2002 at 13:44, Taylor, Jason wrote:

 I'm not sure how you mean nested since there's a tag library called
 struts-nested and I'm not sure if you're referring to that.  If you're
 using that, I think you may not need to, depending on the complexity of
your
 form.
 
 If you have only one dimension of arbitrary length,  it's not really a
 nested situation, and you can try using the indexed property of the
 various html tags (such as html:text).  You need to have an array of beans
 in your action form class with the appropriate get/set methods for each
 column in your list.  The array corresponds to the set of request
 parameters sent from an array on the form that you populate using a
 logic:iterate block in the JSP.  Struts will automatically figure out that
 the customer[0].name request parameter is the name property on the
first
 customer bean in your customer bean array in the action form.
 
 Don't try it with Struts 1.0x, though, as indexed is a 1.1 feature...
 
 
 -Original Message-
 From: Howard Miller [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 21, 2002 1:02 PM
 To: struts Users Mailing List
 Subject: Nested Indexed Property
 
 
 Hi,
 
 Sorry for repeating myself, but I think having read a lot more I can ask
the
 question 
 with a bit more intelligence.
 
 To set the scene may I quote from the documentation:
 
 You may also place a bean instance on your form, and use nested property 
 references. For example, you might have a customer bean on your Action 
 Form, and then refer to the property customer.name in your JSP view.
This 
 would correspond to the methods customer.getName() and 
 customer.setName(string Name) on your customer bean
 
 fine... BUT what if name is a property of an object in the LIST customer.
So
 
 (working backwards) I want to create the reference:
 customer.get( i ).setName(string Name) (oversimplified I know).
 
 BUT it gets worse the index, i, is actually a property set on the
 previous JSP 
 page... so its more like
 customer.get( reqest.getParameter( index ) ).setName(string Name )
 ...and of course the form action needs to properly read the current values
 into 
 the form text fields and then set them back into the correct place. I have
 no 
 clue how to do this! Any offers?
 HM
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail

Nested Indexed Property

2002-09-21 Thread Howard Miller

Hi,

Sorry for repeating myself, but I think having read a lot more I can ask the question 
with a bit more intelligence.

To set the scene may I quote from the documentation:

You may also place a bean instance on your form, and use nested property 
references. For example, you might have a customer bean on your Action 
Form, and then refer to the property customer.name in your JSP view. This 
would correspond to the methods customer.getName() and 
customer.setName(string Name) on your customer bean

fine... BUT what if name is a property of an object in the LIST customer. So 
(working backwards) I want to create the reference:
customer.get( i ).setName(string Name) (oversimplified I know).

BUT it gets worse the index, i, is actually a property set on the previous JSP 
page... so its more like
customer.get( reqest.getParameter( index ) ).setName(string Name )
...and of course the form action needs to properly read the current values into 
the form text fields and then set them back into the correct place. I have no 
clue how to do this! Any offers?
HM

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




Re: Nested Indexed Property

2002-09-21 Thread V. Cekvenich

Not sure what your question is:
If you want to do multi row displays or multi row displays, I have beans 
that implement iterator or collection (getRow).
If your want to update multiple beans, you can have such beans within a 
bean.

If you have issues with setters, you can unit test them outside of 
Struts or webapps.

If you have issues with parms or attributes, you can debug them my 
iterating all the attributes/parms for request/session and see what you 
have.

Try going step by step. Test the setter. Test the parms. Test the 
iteration. (To me, the main attraction of MVC is that you can unit test 
each component before using it).
V.


Howard Miller wrote:
 Hi,
 
 Sorry for repeating myself, but I think having read a lot more I can ask the 
question 
 with a bit more intelligence.
 
 To set the scene may I quote from the documentation:
 
 You may also place a bean instance on your form, and use nested property 
 references. For example, you might have a customer bean on your Action 
 Form, and then refer to the property customer.name in your JSP view. This 
 would correspond to the methods customer.getName() and 
 customer.setName(string Name) on your customer bean
 
 fine... BUT what if name is a property of an object in the LIST customer. So 
 (working backwards) I want to create the reference:
 customer.get( i ).setName(string Name) (oversimplified I know).
 
 BUT it gets worse the index, i, is actually a property set on the previous JSP 
 page... so its more like
 customer.get( reqest.getParameter( index ) ).setName(string Name )
 ...and of course the form action needs to properly read the current values into 
 the form text fields and then set them back into the correct place. I have no 
 clue how to do this! Any offers?
 HM




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




Re: Nested Indexed Property

2002-09-21 Thread Howard Miller

The problem is that I don't know the best way to do what I want to do.

Data structure looks like this

Bean A contains Linked List
  List Item 0 
  List Item 1
  List Item 2
  
  List Item n

Each List Item points to a bean. This bean looks like (for arguments sake - its more 
complicated than this)...

Bean B.Name
Bean B.Address

I have a screen that lists the linked lists and invites the user to edit any of the 
objects 
in the list - remember they already exist and are populated (read from database).

So the edit button points (indirectly or otherwise) to the next page which contains a 
form to edit the data (ie, the bean POINTED TO by the linked list). But now I have 
problems.

1. What do I put in the html:form tag and the config xml for that matter. 
2. How do I have the fact that the bean already exists
3. How do I handle the fact that the bean to use is unknown until run time
4. How do I handle the fact that the bean is referenced by an ArrayList

I basically need to edit the contents of a bean that is dynamically allocated to the 
form 
at run time. The structure of the bean IS fixed though, so I don't think I'm talking 
about DynaBeans. 

I have thought about (in the action called from the first page) creating a new bean in 
the request scope just containing the selected bean from the list. This gets really 
confusing and has issues of its own.

Does this make more sense? I'm really stuck here!!! Any help greatly appreciated.

Howard

On 21 Sep 2002 at 16:19, V. Cekvenich wrote:

 Not sure what your question is:
 If you want to do multi row displays or multi row displays, I have beans 
 that implement iterator or collection (getRow).
 If your want to update multiple beans, you can have such beans within a 
 bean.
 
 If you have issues with setters, you can unit test them outside of 
 Struts or webapps.
 
 If you have issues with parms or attributes, you can debug them my 
 iterating all the attributes/parms for request/session and see what you 
 have.
 
 Try going step by step. Test the setter. Test the parms. Test the 
 iteration. (To me, the main attraction of MVC is that you can unit test 
 each component before using it).
 V.
 
 
 Howard Miller wrote:
  Hi,
  
  Sorry for repeating myself, but I think having read a lot more I can ask the 
question 
  with a bit more intelligence.
  
  To set the scene may I quote from the documentation:
  
  You may also place a bean instance on your form, and use nested property 
  references. For example, you might have a customer bean on your Action 
  Form, and then refer to the property customer.name in your JSP view. This 
  would correspond to the methods customer.getName() and 
  customer.setName(string Name) on your customer bean
  
  fine... BUT what if name is a property of an object in the LIST customer. So 
  (working backwards) I want to create the reference:
  customer.get( i ).setName(string Name) (oversimplified I know).
  
  BUT it gets worse the index, i, is actually a property set on the previous JSP 
  page... so its more like
  customer.get( reqest.getParameter( index ) ).setName(string Name )
  ...and of course the form action needs to properly read the current values into 
  the form text fields and then set them back into the correct place. I have no 
  clue how to do this! Any offers?
  HM
 
 
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 



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




RE: Nested Indexed Property

2002-09-21 Thread Taylor, Jason

I'm not sure how you mean nested since there's a tag library called
struts-nested and I'm not sure if you're referring to that.  If you're
using that, I think you may not need to, depending on the complexity of your
form.

If you have only one dimension of arbitrary length,  it's not really a
nested situation, and you can try using the indexed property of the
various html tags (such as html:text).  You need to have an array of beans
in your action form class with the appropriate get/set methods for each
column in your list.  The array corresponds to the set of request
parameters sent from an array on the form that you populate using a
logic:iterate block in the JSP.  Struts will automatically figure out that
the customer[0].name request parameter is the name property on the first
customer bean in your customer bean array in the action form.

Don't try it with Struts 1.0x, though, as indexed is a 1.1 feature...


-Original Message-
From: Howard Miller [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 1:02 PM
To: struts Users Mailing List
Subject: Nested Indexed Property


Hi,

Sorry for repeating myself, but I think having read a lot more I can ask the
question 
with a bit more intelligence.

To set the scene may I quote from the documentation:

You may also place a bean instance on your form, and use nested property 
references. For example, you might have a customer bean on your Action 
Form, and then refer to the property customer.name in your JSP view. This 
would correspond to the methods customer.getName() and 
customer.setName(string Name) on your customer bean

fine... BUT what if name is a property of an object in the LIST customer. So

(working backwards) I want to create the reference:
customer.get( i ).setName(string Name) (oversimplified I know).

BUT it gets worse the index, i, is actually a property set on the
previous JSP 
page... so its more like
customer.get( reqest.getParameter( index ) ).setName(string Name )
...and of course the form action needs to properly read the current values
into 
the form text fields and then set them back into the correct place. I have
no 
clue how to do this! Any offers?
HM

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



Re: Nested Indexed Property

2002-09-21 Thread V. Cekvenich

Then it sounds like you need to read the 4 tutorials on
http://www.keyboardmonkey.com/pilotlight/index.jsp

V

Howard Miller wrote:
 The problem is that I don't know the best way to do what I want to do.
 
 Data structure looks like this
 
 Bean A contains Linked List
   List Item 0 
   List Item 1
   List Item 2
   
   List Item n
 
 Each List Item points to a bean. This bean looks like (for arguments sake - its more 
 complicated than this)...
 
 Bean B.Name
 Bean B.Address
 
 I have a screen that lists the linked lists and invites the user to edit any of the 
objects 
 in the list - remember they already exist and are populated (read from database).
 
 So the edit button points (indirectly or otherwise) to the next page which contains 
a 
 form to edit the data (ie, the bean POINTED TO by the linked list). But now I have 
 problems.
 
 1. What do I put in the html:form tag and the config xml for that matter. 
 2. How do I have the fact that the bean already exists
 3. How do I handle the fact that the bean to use is unknown until run time
 4. How do I handle the fact that the bean is referenced by an ArrayList
 
 I basically need to edit the contents of a bean that is dynamically allocated to the 
form 
 at run time. The structure of the bean IS fixed though, so I don't think I'm talking 
 about DynaBeans. 
 
 I have thought about (in the action called from the first page) creating a new bean 
in 
 the request scope just containing the selected bean from the list. This gets really 
 confusing and has issues of its own.
 
 Does this make more sense? I'm really stuck here!!! Any help greatly appreciated.
 
 Howard
 
 On 21 Sep 2002 at 16:19, V. Cekvenich wrote:
 
 
Not sure what your question is:
If you want to do multi row displays or multi row displays, I have beans 
that implement iterator or collection (getRow).
If your want to update multiple beans, you can have such beans within a 
bean.

If you have issues with setters, you can unit test them outside of 
Struts or webapps.

If you have issues with parms or attributes, you can debug them my 
iterating all the attributes/parms for request/session and see what you 
have.

Try going step by step. Test the setter. Test the parms. Test the 
iteration. (To me, the main attraction of MVC is that you can unit test 
each component before using it).
V.


Howard Miller wrote:

Hi,

Sorry for repeating myself, but I think having read a lot more I can ask the 
question 
with a bit more intelligence.

To set the scene may I quote from the documentation:

You may also place a bean instance on your form, and use nested property 
references. For example, you might have a customer bean on your Action 
Form, and then refer to the property customer.name in your JSP view. This 
would correspond to the methods customer.getName() and 
customer.setName(string Name) on your customer bean

fine... BUT what if name is a property of an object in the LIST customer. So 
(working backwards) I want to create the reference:
customer.get( i ).setName(string Name) (oversimplified I know).

BUT it gets worse the index, i, is actually a property set on the previous JSP 
page... so its more like
customer.get( reqest.getParameter( index ) ).setName(string Name )
...and of course the form action needs to properly read the current values into 
the form text fields and then set them back into the correct place. I have no 
clue how to do this! Any offers?
HM




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






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




RE: Nested Indexed Property

2002-09-21 Thread Taylor, Jason

I'd try using indexed first, that monkey stuff is so silly, it can be kind
of frustrating.  

I've done lists of stuff like this before and I initially made the mistake
of over-using nested tags.  I found that if you have two or more dimensions
of arbitrary listing then you need nested, but if you have just one you can
use indexed properties.

-JT

-Original Message-
From: V. Cekvenich [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 1:53 PM
To: [EMAIL PROTECTED]
Subject: Re: Nested Indexed Property


Then it sounds like you need to read the 4 tutorials on
http://www.keyboardmonkey.com/pilotlight/index.jsp

V

Howard Miller wrote:
 The problem is that I don't know the best way to do what I want to do.
 
 Data structure looks like this
 
 Bean A contains Linked List
   List Item 0 
   List Item 1
   List Item 2
   
   List Item n
 
 Each List Item points to a bean. This bean looks like (for arguments sake
- its more 
 complicated than this)...
 
 Bean B.Name
 Bean B.Address
 
 I have a screen that lists the linked lists and invites the user to edit
any of the objects 
 in the list - remember they already exist and are populated (read from
database).
 
 So the edit button points (indirectly or otherwise) to the next page which
contains a 
 form to edit the data (ie, the bean POINTED TO by the linked list). But
now I have 
 problems.
 
 1. What do I put in the html:form tag and the config xml for that
matter. 
 2. How do I have the fact that the bean already exists
 3. How do I handle the fact that the bean to use is unknown until run time
 4. How do I handle the fact that the bean is referenced by an ArrayList
 
 I basically need to edit the contents of a bean that is dynamically
allocated to the form 
 at run time. The structure of the bean IS fixed though, so I don't think
I'm talking 
 about DynaBeans. 
 
 I have thought about (in the action called from the first page) creating a
new bean in 
 the request scope just containing the selected bean from the list. This
gets really 
 confusing and has issues of its own.
 
 Does this make more sense? I'm really stuck here!!! Any help greatly
appreciated.
 
 Howard
 
 On 21 Sep 2002 at 16:19, V. Cekvenich wrote:
 
 
Not sure what your question is:
If you want to do multi row displays or multi row displays, I have beans 
that implement iterator or collection (getRow).
If your want to update multiple beans, you can have such beans within a 
bean.

If you have issues with setters, you can unit test them outside of 
Struts or webapps.

If you have issues with parms or attributes, you can debug them my 
iterating all the attributes/parms for request/session and see what you 
have.

Try going step by step. Test the setter. Test the parms. Test the 
iteration. (To me, the main attraction of MVC is that you can unit test 
each component before using it).
V.


Howard Miller wrote:

Hi,

Sorry for repeating myself, but I think having read a lot more I can ask
the question 
with a bit more intelligence.

To set the scene may I quote from the documentation:

You may also place a bean instance on your form, and use nested property

references. For example, you might have a customer bean on your Action 
Form, and then refer to the property customer.name in your JSP view.
This 
would correspond to the methods customer.getName() and 
customer.setName(string Name) on your customer bean

fine... BUT what if name is a property of an object in the LIST customer.
So 
(working backwards) I want to create the reference:
customer.get( i ).setName(string Name) (oversimplified I know).

BUT it gets worse the index, i, is actually a property set on the
previous JSP 
page... so its more like
customer.get( reqest.getParameter( index ) ).setName(string Name )
...and of course the form action needs to properly read the current
values into 
the form text fields and then set them back into the correct place. I
have no 
clue how to do this! Any offers?
HM




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






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



RE: Nested Indexed Property

2002-09-21 Thread Howard Miller

No, I have never used struts-nested.

The documentation says that the indexed property is only for use inside a 
logic:iterate tag. I'm not inside a logic iterate tag.

To put it as simply as possible.

Page 1 has a link: a href=page2.jsp?index=5
(and I accept that this might be page2.do!!

and page 2 needs to do 
html:text name=beanwithlist[ index ] property=name /

geddit? index is a property generated according to the user selection on the previous 
page. This is what I need to index the data by. The second page would be a simple, 
basic edit form but for the fact that I have no idea how to reference the bean it uses 
because it is part of a linked list in some other bean with a dynamic reference.

Phew

HM

On 21 Sep 2002 at 13:44, Taylor, Jason wrote:

 I'm not sure how you mean nested since there's a tag library called
 struts-nested and I'm not sure if you're referring to that.  If you're
 using that, I think you may not need to, depending on the complexity of your
 form.
 
 If you have only one dimension of arbitrary length,  it's not really a
 nested situation, and you can try using the indexed property of the
 various html tags (such as html:text).  You need to have an array of beans
 in your action form class with the appropriate get/set methods for each
 column in your list.  The array corresponds to the set of request
 parameters sent from an array on the form that you populate using a
 logic:iterate block in the JSP.  Struts will automatically figure out that
 the customer[0].name request parameter is the name property on the first
 customer bean in your customer bean array in the action form.
 
 Don't try it with Struts 1.0x, though, as indexed is a 1.1 feature...
 
 
 -Original Message-
 From: Howard Miller [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 21, 2002 1:02 PM
 To: struts Users Mailing List
 Subject: Nested Indexed Property
 
 
 Hi,
 
 Sorry for repeating myself, but I think having read a lot more I can ask the
 question 
 with a bit more intelligence.
 
 To set the scene may I quote from the documentation:
 
 You may also place a bean instance on your form, and use nested property 
 references. For example, you might have a customer bean on your Action 
 Form, and then refer to the property customer.name in your JSP view. This 
 would correspond to the methods customer.getName() and 
 customer.setName(string Name) on your customer bean
 
 fine... BUT what if name is a property of an object in the LIST customer. So
 
 (working backwards) I want to create the reference:
 customer.get( i ).setName(string Name) (oversimplified I know).
 
 BUT it gets worse the index, i, is actually a property set on the
 previous JSP 
 page... so its more like
 customer.get( reqest.getParameter( index ) ).setName(string Name )
 ...and of course the form action needs to properly read the current values
 into 
 the form text fields and then set them back into the correct place. I have
 no 
 clue how to do this! Any offers?
 HM
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 



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




Re: Nested Indexed Property

2002-09-21 Thread V. Cekvenich

I use index and getRow(). However, there is sample code and a tutorial, 
and could be a usefull transition.

V.

Taylor, Jason wrote:
 I'd try using indexed first, that monkey stuff is so silly, it can be kind
 of frustrating.  
 
 I've done lists of stuff like this before and I initially made the mistake
 of over-using nested tags.  I found that if you have two or more dimensions
 of arbitrary listing then you need nested, but if you have just one you can
 use indexed properties.
 
 -JT
 
 -Original Message-
 From: V. Cekvenich [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 21, 2002 1:53 PM
 To: [EMAIL PROTECTED]
 Subject: Re: Nested Indexed Property
 
 
 Then it sounds like you need to read the 4 tutorials on
 http://www.keyboardmonkey.com/pilotlight/index.jsp
 
 V
 
 Howard Miller wrote:
 
The problem is that I don't know the best way to do what I want to do.

Data structure looks like this

Bean A contains Linked List
  List Item 0 
  List Item 1
  List Item 2
  
  List Item n

Each List Item points to a bean. This bean looks like (for arguments sake
 
 - its more 
 
complicated than this)...

Bean B.Name
Bean B.Address

I have a screen that lists the linked lists and invites the user to edit
 
 any of the objects 
 
in the list - remember they already exist and are populated (read from
 
 database).
 
So the edit button points (indirectly or otherwise) to the next page which
 
 contains a 
 
form to edit the data (ie, the bean POINTED TO by the linked list). But
 
 now I have 
 
problems.

1. What do I put in the html:form tag and the config xml for that
 
 matter. 
 
2. How do I have the fact that the bean already exists
3. How do I handle the fact that the bean to use is unknown until run time
4. How do I handle the fact that the bean is referenced by an ArrayList

I basically need to edit the contents of a bean that is dynamically
 
 allocated to the form 
 
at run time. The structure of the bean IS fixed though, so I don't think
 
 I'm talking 
 
about DynaBeans. 

I have thought about (in the action called from the first page) creating a
 
 new bean in 
 
the request scope just containing the selected bean from the list. This
 
 gets really 
 
confusing and has issues of its own.

Does this make more sense? I'm really stuck here!!! Any help greatly
 
 appreciated.
 
Howard

On 21 Sep 2002 at 16:19, V. Cekvenich wrote:



Not sure what your question is:
If you want to do multi row displays or multi row displays, I have beans 
that implement iterator or collection (getRow).
If your want to update multiple beans, you can have such beans within a 
bean.

If you have issues with setters, you can unit test them outside of 
Struts or webapps.

If you have issues with parms or attributes, you can debug them my 
iterating all the attributes/parms for request/session and see what you 
have.

Try going step by step. Test the setter. Test the parms. Test the 
iteration. (To me, the main attraction of MVC is that you can unit test 
each component before using it).
V.


Howard Miller wrote:


Hi,

Sorry for repeating myself, but I think having read a lot more I can ask

 the question 
 
with a bit more intelligence.

To set the scene may I quote from the documentation:

You may also place a bean instance on your form, and use nested property

 
references. For example, you might have a customer bean on your Action 
Form, and then refer to the property customer.name in your JSP view.

 This 
 
would correspond to the methods customer.getName() and 
customer.setName(string Name) on your customer bean

fine... BUT what if name is a property of an object in the LIST customer.

 So 
 
(working backwards) I want to create the reference:
customer.get( i ).setName(string Name) (oversimplified I know).

BUT it gets worse the index, i, is actually a property set on the

 previous JSP 
 
page... so its more like
customer.get( reqest.getParameter( index ) ).setName(string Name )
...and of course the form action needs to properly read the current

 values into 
 
the form text fields and then set them back into the correct place. I

 have no 
 
clue how to do this! Any offers?
HM




--
To unsubscribe, e-mail:

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

 mailto:[EMAIL PROTECTED]
 

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




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




  1   2   >