Indexed Properties

2003-07-28 Thread atta-ur rehman
Dea all,

I've been reading an indexed properties article at:

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

Whereas this article shows how to read indexed properties in the JSP page it
doesn't show how to submission of a JSP page will work with the indexed
properties. I tried to submit my JSP page with indexed properties but it
complains about non-existent getter/setter for the property.

Now my question is: is it possible at to do submission on indexed
properties? Any instructive example would be great!

Regards,

ATTA

PS: Maybe Daivd M. Carr could throw some light on it!



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



indexed properties

2003-09-08 Thread Michael Muller
The following article seems to differ in approach from how the posters 
to this forum implement indexed properties in struts:

http://www.developer.com/java/other/article.php/2233591

In this article, the author uses a DynaActionForm which automatically 
builds an array of "normal" beans.  By "normal", I mean that the beans 
have methods like this:

String getFoo()
void setFoo(String foo)
rather than this, as is often advocated in this forum:

String getFoo(int index)
void setFoo(String foo, int index)
I prefer the former approach except for one minor factor: it doesn't 
seem to work.   :(

Struts seems to be creating me a valid form.  I say this becuase I have 
an iterator on my form that displays the right number of rows of text 
boxes, and they all have names like "mybean[0].foo".  Furthermore, if I 
change the "property" attribute of my "html:text" tag to "bar", I get an 
exception when I render the page that there is no "bar" property.

So things seem to be working well, up to this point, but in the 
implementation of the action, my form bean doesn't have any values set. 
 They're not even blank; they're null.  I stuck a println in a setter 
method -- it's not even being called.

I can, however, see the values in the request parameters if I print them 
out in the implementation of the action.

Help!  Actual code follows.

Thanks in advance,

-- Mike

STRUTS-CONFIG.XML


  
  



SHIPMENTFORMBEAN.JAVA --

public class ShipmentFormBean
{
private String mDestination;
private String mSize;
private String mVariety;
private String mQuantity;
private String mPrice;
private String mZipCode;
// YANKED A BUNCH OF GETTERS/SETTERS

public String getSize()
{
return mSize;
}
public void setSize(String size)
{
System.out.println("### setting size to " + size);
mSize = size;
}
}
SHIPMENTS.JSP


  
<%-- lots of jsp code and html yanked --%>

   70 
   84 


  Select a city
  - 
  


  





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


indexed properties

2003-10-09 Thread david.ballard
I'm working through the examples on 
http://jakarta.apache.org/struts/faqs/indexedprops.html and have some questions.

I am able to get the sample code under 'Indexed Properties' to work fine. 
--
package Beans;
import org.apache.struts.action.ActionForm;
public class testBean extends ActionForm {
private String strAry[] = { "String 0", "String 1", "String 2", "String 3", 
"String 4" };

public String getStringIndexed(int index) { 
return strAry[index]; 
}

public void setStringIndexed(int index, String value) { 
strAry[index] = value; 
}
}

jsp
---

 

 ---> prints String 1




Under 'Dynamic Indexes for Indexed Properties' I receive an error stating ... (after 
adding in  so the bean could be 
used)
"org.apache.jasper.JasperException: No getter method for property stringArray 
of bean stringbean."










--

'stringArray' was not defined in the original formbean, but stringIndexed was so I 
modified the code to:










--

and receive the error:
"org.apache.jasper.JasperException: No getter method for property 
stringIndexed of bean stringbean"
despite the getter method being defined in Beans.testBean.


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



Indexed properties

2003-12-11 Thread Marcus Peixoto
How can I get indexed properties in my action class ? 
I've seen an example that uses the method get("property") but it's based
in a Dynamic Form which is not my case. In that case, it is possible to
obtain using get("property"). 
In my case the Form doesn't have the property "addr" as in example
below:







Thanks in advance for any help

Marcus Peixoto


indexed properties

2003-12-15 Thread Alex Reznik
hey guys, 
i am drawing a complete blank,may be cause its monday, 
i generate some fields on the webpage using javascript, and make them
indexed, so i end up having fields like entry[0].area,
entry[0].description...and i want to make sure that each index ends up as a
part of a separate object or at least an entry in an array , 
does anyone know how to set up the ActionForm so that i can pull them in
sync?
Thanks, 
Alex

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



Indexed Properties

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]

indexed properties.

2003-05-29 Thread Abhinav (Cognizant)
Will someone please tell me how to override indexed naming (like name[0], name[1], 
name[2])
in my form when my form bean has 
attribute 
String [] name 
and methods 
getName(int index), setName(int index, String nm).

thanx, coz its really urgent. 
I need this b'coz i cant validate field named name[0] in javascript


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

Indexed Properties

2002-07-16 Thread Arnaud HERITIER

Hi guys.

I'm trying to use the Indexed properties of Struts 1.1.

What I understood about indexedProperties is that it allows to have a set of
properties (in a form bean) represented by an array of Strings.

What I want to do is quite simple.

I have a form with a dynamic list of radio buttons groups.

in HTML it is something like this :








in Java with Struts I wrote a FormBean (class MyFormBean) with a property
using an array of strings : String[] myRadios (with getter and setter)

in the JSP :







If I initialize the property myRadios of my formbean with the following
Array : String[] myRadios = {"A","A","B","A"};
the JSP generates the good numbers of radio items like this :








but the problem is that this radios aren't initialized with the good checked
properties.

What I'm waiting for is somethink like :








I don't understand what happens ??

Can you help me please.

Thx.

  Arnaud HERITIER
  EAI Consulting
  Sopra Group
  Tél. : +33 (0)1 53 33 44 74
  email : [EMAIL PROTECTED]

  Ce message est exclusivement destiné aux personnes dont le nom figure
ci-dessus. Il peut contenir des informations confidentielles dont la
divulgation est à ce titre rigoureusement interdite. Dans l'hypothèse où
vous avez reçu ce message par erreur, merci de le renvoyer à l'adresse
e-mail ci-dessus et de détruire toute copie.

  This message may contain confidential and proprietary material for the
sole use of the intended recipient. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact
the sender and delete all copies.




Indexed Properties

2002-02-22 Thread Sridhar M

Hi,
  I have a requirement wherein my HTML Form contains
around 100 textfields. I want to use struts to handle
this form automatically. But the problem is that I
can't define 100 setter and getter methods.I tried
using indexed properties with form beans but did not
succeed. 

Does Struts support the indexed properties concept
defined by Javabeans. If so how to implement it.

Thanks in advance,
Sridhar

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

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




indexed properties

2002-02-26 Thread Maris Orbidans


How to use indexed properties?

Please, give me an URL with examples or documents.


Maris Orbidans


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




indexed properties

2002-02-27 Thread Maris Orbidans

hello

Do I have to use Nightly Build to get subj. ?

1.0.2 says 

"Lemums1.jsp": Attribute indexed invalid according to the specified TLD
at line 194, column 5





Searched mail archive but didnt find any useful.


Maris Orbidans


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Indexed Properties

2001-06-27 Thread Jason Rosenblum

Hello all,

I'm trying to get my code to work with indexed properties. Thanks to Dave Hay and his 
Struts tweak, I was able to generate input types like this:



using the following Struts tags:



The problem is that I cannot get my ActionForm to pick up these input fields. I wrote 
several setters and getters in my ActionForm:
   /**
 * Return the users.
 */
public String getUsers(int i) {

return (users[i].getUsername());

}


/**
 * Set a user.
 *
 * @param user
 * @param index
 */
public void setUsers(int i, String user) {
this.users[i].setUsername(user);

}
 
 
/**
 * Return the users.
 */
public User[] getUsers() {

return (this.users);

}


/**
 * Set a user.
 *
 * @param user list
 */
public void setUsers(User[] users) {
this.users = users;

}
 
/**
 * Return the roles.
 */
public String getRoles(int i) {

return (users[i].getRole());

}


/**
 * Set a role.
 *
 * @param role
 * @param index
 */
public void setRoles(int i, String role) {

this.users[i].setRole(role);

}
 
 
/**
 * Return the roles.
 */
public User[] getRoles() {

return (this.users);

}


/**
 * Set a role.
 *
 * @param role list
 */
public void setRoles(User[] roles) {

this.users = users;

} 


Do you see anything wrong with this scheme? Currently, the ActionForm returns null for 
all items in the User[] when I call any of the get methods. Please help.

~Jason



indexed properties

2001-07-07 Thread cahana



Hi everyone-
 
    I need some help on using the indexed 
properties for html:text option. I've implemented Dave Hay's modification and 
can get the input boxes to show up using the iterate tag.
 
 
<%= courseNumber++ %> 
 
 
 
  
 
This is what my CourseList bean looks like:
 
public final class CourseList extends 
ActionForm{  private ArrayList courseList 
= new ArrayList(6); 
 public ArrayList 
getCourseList() {  return(this.courseList); }
 
 public void setCourseList(ArrayList 
courseList) {  this.courseList = 
courseList; }
 
 public CourseForm getCourseForm(int 
index) {  return 
(CourseForm)courseList.get(index);
 }  public void setCourseForm(int 
index, CourseForm course) {  this.courseList.add(index, 
course); }}
 
The problem i have is that when i try to submit the 
information and try to access CourseList.getCourseList(), it bombs and says 
CourseList cannot be found. The scope is request. I tried putting it in the 
session and can access it that way but it doesn't have the changes that were 
made on the form. Anybody know what i'm doing wrong?
 
thanks,
cameron


Indexed properties

2001-07-25 Thread Nathan Coast

Hi,

What I want to do is to have multiple text fields in a table get assigned to
an array or collection property in an ActionForm.

I've followed a few threads in the newsgroups about this and have tried some
jsp code:







but this produces this jsp error:

/pages/test/TestIndexedPropertyPage_Body.jsp(11): for tag 'text' handler
type 'org.apache.struts.taglib.html.TextTag' has no property 'indexed'

Is the "indexed" property a non-standard struts patch / extension I have to
use?

Thanks 
Nathan


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**



Indexed Properties

2002-01-22 Thread Marcus Brito

Hello, folks. I'm currently using Struts 1.0.1 and was wondering if
there is a way to use indexed properties in ActionForm classes. 

I know there is support for this in HEAD, but I'm coding an
enterprise-critical application and I hope not to use 'bleeding edge'
components.

I'll give an example of my need: I have a form dinamically generated
using  that contains a checkbox for each iteration. Now I
need an action to process the whole form. As of now, the Action is
defined as having no associated ActionForm, and the perform() method
usess request.getParameterValues() calls to get the form values. There
is a way to do this using ActionForms?

-- 
Ja ne,
   Pazu
   mailto: [EMAIL PROTECTED]

Anime Gaiden: de fãs para fãs, sempre.



signature.asc
Description: This is a digitally signed message part


RE: Indexed Properties

2003-07-28 Thread Paananen, Tero
> I've been reading an indexed properties article at:
> 
> http://jakarta.apache.org/struts/faqs/indexedprops.html

Also read http://www.developer.com/java/other/article.php/2233591

Very helpful.

-TPP

-
This email may contain confidential and privileged material for the sole use of the 
intended recipient(s). Any review, use, retention, distribution or disclosure by 
others is strictly prohibited. If you are not the intended recipient (or authorized to 
receive for the recipient), please contact the sender by reply email and delete all 
copies of this message.  Also, email is susceptible to data corruption, interception, 
tampering, unauthorized amendment and viruses. We only send and receive emails on the 
basis that we are not liable for any such corruption, interception, tampering, 
amendment or viruses or any consequence thereof.


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



Re: Indexed Properties

2003-07-28 Thread atta-ur rehman
Thanks. It was helpful.

But it still leaves me thinking if Indexed Properties are meant ONLY for
DynaActionForm type of forms?

I'm still unable to use them by using an array in my conventional
ActionForm.

ATTA


- Original Message - 
From: "Paananen, Tero" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 10:12 AM
Subject: RE: Indexed Properties


> > I've been reading an indexed properties article at:
> >
> > http://jakarta.apache.org/struts/faqs/indexedprops.html
>
> Also read http://www.developer.com/java/other/article.php/2233591
>
> Very helpful.
>
> -TPP
>
> -
> This email may contain confidential and privileged material for the sole
use of the intended recipient(s). Any review, use, retention, distribution
or disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact the
sender by reply email and delete all copies of this message.  Also, email is
susceptible to data corruption, interception, tampering, unauthorized
amendment and viruses. We only send and receive emails on the basis that we
are not liable for any such corruption, interception, tampering, amendment
or viruses or any consequence thereof.
>
>
> -
> 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 Properties

2003-07-28 Thread Nicholas L Mohler





Atta,

You can use indexed properties in your ActionForm class.  The key is having
all of the correct methods in your form class.

1)  Getter and setter:  You need a get/Set method for the collection that
you refer to in your jsp.  for example:
public Collection getLocations()
public void setLocations(Collection locs)

2) Getter and setter for one instance in the collection.  The name that you
use must match the name you define in your jsp as a single instance from
the collection (specified as the id).  For example:









Your form should in this case have the following get/set methods:
public com.myco.toolkits.beans.Location getOneLocation(int index)
public void setOneLocation(int index, com.myco.toolkits.beans.Location
oneLocation)

Your code may never use either of the "oneLocation" methods, but they are
important for Struts.  When your page is submitted, your two indexed
properties will be submitted as oneLocation[ix].locationName &
oneLocation[ix].locationAddress where ix is the index of the row (0-10 for
example).  As Struts proceses the indexed items, Struts will use the
"getOneLocation" method to get the Collection instance for the provided
index.  This method must resize the collection as needed and then return
the object for the provided index.  For example, if your collection has no
objects and the getter receives an index of 2, the method should load the
first three (0, 1, 2) collection locations with an initialized object and
return the third object.  Struts will then populate the appropriate
property in that object.

As an aside, I tend to use the ArrayList object as my collection type when
working with indexed properties, but I know that the Vector works equally
well.  A simple array will work fine, but the logic to expand the size is a
little more involved.

Let me know if this helps.
Nick



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



Re: Indexed Properties

2003-07-28 Thread atta-ur rehman
Thanks very much Nick! It was indeed helpful. I was missing getter/setter
for individual list items!

now my form has following methods:
private String[] fruit = {"Apple", "Orange", "Banana"};

public List getFruits() {

return Arrays.asList(this.fruit);

}

public void setFruits(List l) {

this.fruit = (String[]) l.toArray();

}


public String getFruit(int index) {

if (this.fruit == null) return "null";

return this.fruit[index];

}

public void setFruit(int index, String f) {

this.fruit[index] = f;

}

my JSP has following has this html:iterator:


   

 hi!


 

   
  

and exception i get is this:

javax.servlet.jsp.JspException: No getter method for property fruit of bean
oneF
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)


i think it has to do with the fact that my individual fruit is a string
object rather than being a bean in itself if some getter method(s)?

can you see what's going wrong!

Thanks again.

ATTA

- Original Message - 
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 11:58 AM
Subject: Re: Indexed Properties


>
>
>
>
>
> Atta,
>
> You can use indexed properties in your ActionForm class.  The key is
having
> all of the correct methods in your form class.
>
> 1)  Getter and setter:  You need a get/Set method for the collection that
> you refer to in your jsp.  for example:
> public Collection getLocations()
> public void setLocations(Collection locs)
>
> 2) Getter and setter for one instance in the collection.  The name that
you
> use must match the name you define in your jsp as a single instance from
> the collection (specified as the id).  For example:
>  type="com.myco.toolkits.beans.Location">
> 
>  ="true"/>
> 
> 
>  indexed="true"/>
> 
> 
>
> Your form should in this case have the following get/set methods:
> public com.myco.toolkits.beans.Location getOneLocation(int index)
> public void setOneLocation(int index, com.myco.toolkits.beans.Location
> oneLocation)
>
> Your code may never use either of the "oneLocation" methods, but they are
> important for Struts.  When your page is submitted, your two indexed
> properties will be submitted as oneLocation[ix].locationName &
> oneLocation[ix].locationAddress where ix is the index of the row (0-10 for
> example).  As Struts proceses the indexed items, Struts will use the
> "getOneLocation" method to get the Collection instance for the provided
> index.  This method must resize the collection as needed and then return
> the object for the provided index.  For example, if your collection has no
> objects and the getter receives an index of 2, the method should load the
> first three (0, 1, 2) collection locations with an initialized object and
> return the third object.  Struts will then populate the appropriate
> property in that object.
>
> As an aside, I tend to use the ArrayList object as my collection type when
> working with indexed properties, but I know that the Vector works equally
> well.  A simple array will work fine, but the logic to expand the size is
a
> little more involved.
>
> Let me know if this helps.
> Nick
>
>
>
> -
> 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 Properties

2003-07-28 Thread Nicholas L Mohler





Atta,

The complaint you are getting is because the property "fruit" is not a
property of the "oneF" bean.  That the oneF object is not a bean with
properties will give you problems.  Depending on your goal, you need to do
something different.  What are you trying to do?

I'm off work in a minute, but I'll check messages at home later this
evening and see if I can help at all.
Nick



   

  "atta-ur rehman" 

  <[EMAIL PROTECTED]To:   "Struts Users Mailing List" 
<[EMAIL PROTECTED]>  
  com> cc: 

       Subject:  Re: Indexed Properties

  07/28/2003 03:44 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





Thanks very much Nick! It was indeed helpful. I was missing getter/setter
for individual list items!

now my form has following methods:
private String[] fruit = {"Apple", "Orange", "Banana"};

public List getFruits() {

return Arrays.asList(this.fruit);

}

public void setFruits(List l) {

this.fruit = (String[]) l.toArray();

}


public String getFruit(int index) {

if (this.fruit == null) return "null";

return this.fruit[index];

}

public void setFruit(int index, String f) {

this.fruit[index] = f;

}

my JSP has following has this html:iterator:


   

 hi!


 

   
  

and exception i get is this:

javax.servlet.jsp.JspException: No getter method for property fruit of bean
oneF
 at
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)


i think it has to do with the fact that my individual fruit is a string
object rather than being a bean in itself if some getter method(s)?

can you see what's going wrong!

Thanks again.

ATTA

- Original Message -
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 11:58 AM
Subject: Re: Indexed Properties


>
>
>
>
>
> Atta,
>
> You can use indexed properties in your ActionForm class.  The key is
having
> all of the correct methods in your form class.
>
> 1)  Getter and setter:  You need a get/Set method for the collection that
> you refer to in your jsp.  for example:
> public Collection getLocations()
> public void setLocations(Collection locs)
>
> 2) Getter and setter for one instance in the collection.  The name that
you
> use must match the name you define in your jsp as a single instance from
> the collection (specified as the id).  For example:
>  type="com.myco.toolkits.beans.Location">
> 
>  ="true"/>
> 
> 
>  indexed="true"/>
> 
> 
>
> Your form should in this case have the following get/set methods:
> public com.myco.toolkits.beans.Location getOneLocation(int index)
> public void setOneLocation(int index, com.myco.toolkits.beans.Location
> oneLocation)
>
> Your code may never use either of the "oneLocation" methods, but they are
> important for Struts.  When your page is submitted, your two indexed
> properties will be submitted as oneLocation[ix].locationName &
> oneLocation[ix].locationAddress where ix is the index of the row (0-10
for
> example).  As Struts proceses the indexed items, Struts will use the
> "getOneLocation" method to get the Collection instance for the provided
> index.  This method must resize the collection as needed

Re: Indexed Properties

2003-07-28 Thread atta-ur rehman
Thanks, for the reply.

Okay, here is the background. I'm trying to learn the user of Indexed
Properties. Why I'm doing that? Well, I have a form that lists, let's say
for the sake of simplicity, Block Name and Block Type columns. Block Name is
a readonly text field while the Block Type is a dropdown list box with a set
of reference values  coming from the database. User can have n blocks on the
page and he can change the block type of any block on the page. user cannot
define a new block on this page.

In my form I've got String[] getter/setters for blockName and blockType
properties. In my action, I set both these arrays reading from the database.
Block Names show allright, but the block type dropdown, that is using
html:select tag, shows same type for all the blocks irrespective of the type
of the block read from database.

Now a few days back i asked a question on this forum regarding how to have
my dropdowns display the right block type as set in the blockType String[]
property of the form. Someone, I think it was Wendy Smoak, and i've seen
quite a lot of helpful mails from him, mentioned that Indexed Properties
might be the way go. Althogh, he also mentioned that he hasn't used them.

I solved the problem by using "value" property of html:select tag. the doc
says that "value" property denotes the value of the listbox that would be
used to select an item in the list. so far so good.

now the kind of guy i'm, i thought why not try it thrue index properties and
learn something new ;) so i set out to learn indexed properties. read some
articles and still i'm not sure what i'm missing.

Hope this gives you the background and thanks once more for taking some out
to hlep me.

ATTA

- Original Message - 
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 1:09 PM
Subject: Re: Indexed Properties


>
>
>
>
>
> Atta,
>
> The complaint you are getting is because the property "fruit" is not a
> property of the "oneF" bean.  That the oneF object is not a bean with
> properties will give you problems.  Depending on your goal, you need to do
> something different.  What are you trying to do?
>
> I'm off work in a minute, but I'll check messages at home later this
> evening and see if I can help at all.
> Nick
>
>
>
>
>   "atta-ur rehman"
>   <[EMAIL PROTECTED]To:   "Struts Users
Mailing List" <[EMAIL PROTECTED]>
>   com> cc:
>Subject:  Re: Indexed
Properties
>   07/28/2003 03:44
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
> Thanks very much Nick! It was indeed helpful. I was missing getter/setter
> for individual list items!
>
> now my form has following methods:
> private String[] fruit = {"Apple", "Orange", "Banana"};
>
> public List getFruits() {
>
> return Arrays.asList(this.fruit);
>
> }
>
> public void setFruits(List l) {
>
> this.fruit = (String[]) l.toArray();
>
> }
>
>
> public String getFruit(int index) {
>
> if (this.fruit == null) return "null";
>
> return this.fruit[index];
>
> }
>
> public void setFruit(int index, String f) {
>
> this.fruit[index] = f;
>
> }
>
> my JSP has following has this html:iterator:
>
>  type="java.lang.String" >
>
> 
>  hi!
> 
> 
>  
> 
>
>   
>
> and exception i get is this:
>
> javax.servlet.jsp.JspException: No getter method for property fruit of
bean
> oneF
>  at
> org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:968)
>
>
> i think it has to do with the fact that my individual fruit is a string
> object rather than being a bean in itself if some getter method(s)?
>
> can you see what's going wrong!
>
> Thanks again.
>
> ATTA
>
> - Original Message -
> From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, July 28, 2003 11:58 AM
> Subject: Re: Indexed Properties
>
>
> >
> >
> >
> >
> >
> > Atta,
> >
> > You can use indexed properties in your ActionForm class.  The key is
> having
> > all of the correct methods in your form class.
> >
> > 1)  Getter and setter:  You need a

RE: Indexed Properties

2003-07-28 Thread Nick
Hi Atta,

No problem with the assistance.  Just hope that I can be helpful :-)  In
the cases where I use indexed properties, the property is part of a
larger object.  It sounds to me like you have two arrays in your form
class: one for blockName and one for blockType.  I would suggest
creating a bean with the two properties, and then have a collection of
those objects in your form.

Building on my previous example, you'd have something like this:
 
 
   
 
 
   
  
   
 

This example assumes your collection of blockTypes is part of your form,
but it could be a collection that was in request/session/application
scope.  You would create form entries for the collection like you
implemented in our previous emails.

I have almost this exact code in a few places and it works well.

Hope this helps.
Nick

-Original Message-
From: atta-ur rehman [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 28, 2003 3:37 PM
To: Struts Users Mailing List
Subject: Re: Indexed Properties

Thanks, for the reply.

Okay, here is the background. I'm trying to learn the user of Indexed
Properties. Why I'm doing that? Well, I have a form that lists, let's
say
for the sake of simplicity, Block Name and Block Type columns. Block
Name is
a readonly text field while the Block Type is a dropdown list box with a
set
of reference values  coming from the database. User can have n blocks on
the
page and he can change the block type of any block on the page. user
cannot
define a new block on this page.

In my form I've got String[] getter/setters for blockName and blockType
properties. In my action, I set both these arrays reading from the
database.
Block Names show allright, but the block type dropdown, that is using
html:select tag, shows same type for all the blocks irrespective of the
type
of the block read from database.

Now a few days back i asked a question on this forum regarding how to
have
my dropdowns display the right block type as set in the blockType
String[]
property of the form. Someone, I think it was Wendy Smoak, and i've seen
quite a lot of helpful mails from him, mentioned that Indexed Properties
might be the way go. Althogh, he also mentioned that he hasn't used
them.

I solved the problem by using "value" property of html:select tag. the
doc
says that "value" property denotes the value of the listbox that would
be
used to select an item in the list. so far so good.

now the kind of guy i'm, i thought why not try it thrue index properties
and
learn something new ;) so i set out to learn indexed properties. read
some
articles and still i'm not sure what i'm missing.

Hope this gives you the background and thanks once more for taking some
out
to hlep me.

ATTA

- Original Message - 
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 1:09 PM
Subject: Re: Indexed Properties


>
>
>
>
>
> Atta,
>
> The complaint you are getting is because the property "fruit" is not a
> property of the "oneF" bean.  That the oneF object is not a bean with
> properties will give you problems.  Depending on your goal, you need
to do
> something different.  What are you trying to do?
>
> I'm off work in a minute, but I'll check messages at home later this
> evening and see if I can help at all.
> Nick
>
>
>
>
>   "atta-ur rehman"
>   <[EMAIL PROTECTED]To:   "Struts Users
Mailing List" <[EMAIL PROTECTED]>
>   com> cc:
>Subject:  Re: Indexed
Properties
>   07/28/2003 03:44
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
> Thanks very much Nick! It was indeed helpful. I was missing
getter/setter
> for individual list items!
>
> now my form has following methods:
> private String[] fruit = {"Apple", "Orange", "Banana"};
>
> public List getFruits() {
>
> return Arrays.asList(this.fruit);
>
> }
>
> public void setFruits(List l) {
>
> this.fruit = (String[]) l.toArray();
>
> }
>
>
> public String getFruit(int index) {
>
> if (this.fruit == null) return "null";
>
> return this.fruit[index];
>
> }
>
> public void setFruit(int index, String f) {
>
> this.fruit[index] = f;
>
> }
>
> my JSP has following has this html:iterator:
>
>  type="java.lang.String" >
>
> 
>  hi!
> 
> 
>  
> 
>

Re: Indexed Properties

2003-07-28 Thread atta-ur rehman
Yes, I currently have two independent String arrays for blockName and
blockType. Putting them, and all the other block related properties, is what
seems to be the right thing to do! So you have confirmed.

here is what i have understood from your text:

1) my form would have "blocks" property that would be a collection of Block
beans
2) iterating each block in the blocks collection i can sure display each
block with "indexed=true" directive for text boxes and dropdowns.
3) now for the submission part i'd need to have setBlockType(int, string)
and getBlockType(int) and same for the rest of properties. The name of
property in the Block Form and name of the property in the Block Bean must
match.
4) and it should work?

I've had my head stuck in my computer whole day today and i'm barely able to
write this email :) Tommorrow morning i'd come back and confirm it by
running it. meanwhile I'd appreciate if you could confirm these 4 points
i've noted above!

Thankyou very much for your help. It really did help.

Regards,

ATTA


- Original Message - 
From: "Nick" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 5:08 PM
Subject: RE: Indexed Properties


> Hi Atta,
>
> No problem with the assistance.  Just hope that I can be helpful :-)  In
> the cases where I use indexed properties, the property is part of a
> larger object.  It sounds to me like you have two arrays in your form
> class: one for blockName and one for blockType.  I would suggest
> creating a bean with the two properties, and then have a collection of
> those objects in your form.
>
> Building on my previous example, you'd have something like this:
>type="com.myco.beans.Block">
>  
>
>  
>  
> indexed="true" size="1">
>   
>  
>  
>
> This example assumes your collection of blockTypes is part of your form,
> but it could be a collection that was in request/session/application
> scope.  You would create form entries for the collection like you
> implemented in our previous emails.
>
> I have almost this exact code in a few places and it works well.
>
> Hope this helps.
> Nick
>
> -Original Message-
> From: atta-ur rehman [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 28, 2003 3:37 PM
> To: Struts Users Mailing List
> Subject: Re: Indexed Properties
>
> Thanks, for the reply.
>
> Okay, here is the background. I'm trying to learn the user of Indexed
> Properties. Why I'm doing that? Well, I have a form that lists, let's
> say
> for the sake of simplicity, Block Name and Block Type columns. Block
> Name is
> a readonly text field while the Block Type is a dropdown list box with a
> set
> of reference values  coming from the database. User can have n blocks on
> the
> page and he can change the block type of any block on the page. user
> cannot
> define a new block on this page.
>
> In my form I've got String[] getter/setters for blockName and blockType
> properties. In my action, I set both these arrays reading from the
> database.
> Block Names show allright, but the block type dropdown, that is using
> html:select tag, shows same type for all the blocks irrespective of the
> type
> of the block read from database.
>
> Now a few days back i asked a question on this forum regarding how to
> have
> my dropdowns display the right block type as set in the blockType
> String[]
> property of the form. Someone, I think it was Wendy Smoak, and i've seen
> quite a lot of helpful mails from him, mentioned that Indexed Properties
> might be the way go. Althogh, he also mentioned that he hasn't used
> them.
>
> I solved the problem by using "value" property of html:select tag. the
> doc
> says that "value" property denotes the value of the listbox that would
> be
> used to select an item in the list. so far so good.
>
> now the kind of guy i'm, i thought why not try it thrue index properties
> and
> learn something new ;) so i set out to learn indexed properties. read
> some
> articles and still i'm not sure what i'm missing.
>
> Hope this gives you the background and thanks once more for taking some
> out
> to hlep me.
>
> ATTA
>
> - Original Message - 
> From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, July 28, 2003 1:09 PM
> Subject: Re: Indexed Properties
>
>
> >
> >
> >
> >
> >
> > Atta,
> >
>

Re: Indexed Properties

2003-07-29 Thread Nicholas L Mohler





Atta,

It sounds to me like you have it.  As long as your names match up, it
should work fine.  Ajay has given a full code example that looks good.

Nick



   

  "atta-ur rehman" 

  <[EMAIL PROTECTED]To:   "Struts Users Mailing List" 
<[EMAIL PROTECTED]>  
  com> cc: 

       Subject:  Re: Indexed Properties

  07/28/2003 08:44 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





Yes, I currently have two independent String arrays for blockName and
blockType. Putting them, and all the other block related properties, is
what
seems to be the right thing to do! So you have confirmed.

here is what i have understood from your text:

1) my form would have "blocks" property that would be a collection of Block
beans
2) iterating each block in the blocks collection i can sure display each
block with "indexed=true" directive for text boxes and dropdowns.
3) now for the submission part i'd need to have setBlockType(int, string)
and getBlockType(int) and same for the rest of properties. The name of
property in the Block Form and name of the property in the Block Bean must
match.
4) and it should work?

I've had my head stuck in my computer whole day today and i'm barely able
to
write this email :) Tommorrow morning i'd come back and confirm it by
running it. meanwhile I'd appreciate if you could confirm these 4 points
i've noted above!

Thankyou very much for your help. It really did help.

Regards,

ATTA


- Original Message -
From: "Nick" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 5:08 PM
Subject: RE: Indexed Properties


> Hi Atta,
>
> No problem with the assistance.  Just hope that I can be helpful :-)  In
> the cases where I use indexed properties, the property is part of a
> larger object.  It sounds to me like you have two arrays in your form
> class: one for blockName and one for blockType.  I would suggest
> creating a bean with the two properties, and then have a collection of
> those objects in your form.
>
> Building on my previous example, you'd have something like this:
>type="com.myco.beans.Block">
>  
>
>  
>  
> indexed="true" size="1">
>   
>  
>  
>
> This example assumes your collection of blockTypes is part of your form,
> but it could be a collection that was in request/session/application
> scope.  You would create form entries for the collection like you
> implemented in our previous emails.
>
> I have almost this exact code in a few places and it works well.
>
> Hope this helps.
> Nick
>
> -Original Message-
> From: atta-ur rehman [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 28, 2003 3:37 PM
> To: Struts Users Mailing List
> Subject: Re: Indexed Properties
>
> Thanks, for the reply.
>
> Okay, here is the background. I'm trying to learn the user of Indexed
> Properties. Why I'm doing that? Well, I have a form that lists, let's
> say
> for the sake of simplicity, Block Name and Block Type columns. Block
> Name is
> a readonly text field while the Block Type is a dropdown list box with a
> set
> of reference values  coming from the database. User can have n blocks on
> the
> page and he can change the block type of any block

Re: Indexed Properties

2003-07-29 Thread atta-ur rehman
Hello again Nick.

Well i've come a step forward in that i've been able to successfully show
the jsp page using index="true" for all the rows and submit the form without
any errors too:


   

 


 


 
  
 

   
  

works like a charm!

What i'm still missing what is updated when i submit the form? where can i
get updated values from? my ActionForm has list attirbute called "blocks"
each element in the list is a Block bean object. The Block bean has
getter/setters for id, name and category.

In ActionForm I also included setCategory(int) and getCategory(int, string)
which doesn't seem to be called at all!

something obvious that i'm missing?

Thanks.

ATTA


- Original Message - 
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 2:57 AM
Subject: Re: Indexed Properties


>
>
>
>
>
> Atta,
>
> It sounds to me like you have it.  As long as your names match up, it
> should work fine.  Ajay has given a full code example that looks good.
>
> Nick
>
>
>
>
>   "atta-ur rehman"
>   <[EMAIL PROTECTED]To:   "Struts Users
Mailing List" <[EMAIL PROTECTED]>
>   com> cc:
>Subject:  Re: Indexed
Properties
>   07/28/2003 08:44
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
> Yes, I currently have two independent String arrays for blockName and
> blockType. Putting them, and all the other block related properties, is
> what
> seems to be the right thing to do! So you have confirmed.
>
> here is what i have understood from your text:
>
> 1) my form would have "blocks" property that would be a collection of
Block
> beans
> 2) iterating each block in the blocks collection i can sure display each
> block with "indexed=true" directive for text boxes and dropdowns.
> 3) now for the submission part i'd need to have setBlockType(int, string)
> and getBlockType(int) and same for the rest of properties. The name of
> property in the Block Form and name of the property in the Block Bean must
> match.
> 4) and it should work?
>
> I've had my head stuck in my computer whole day today and i'm barely able
> to
> write this email :) Tommorrow morning i'd come back and confirm it by
> running it. meanwhile I'd appreciate if you could confirm these 4 points
> i've noted above!
>
> Thankyou very much for your help. It really did help.
>
> Regards,
>
> ATTA
>
>
> - Original Message -
> From: "Nick" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Monday, July 28, 2003 5:08 PM
> Subject: RE: Indexed Properties
>
>
> > Hi Atta,
> >
> > No problem with the assistance.  Just hope that I can be helpful :-)  In
> > the cases where I use indexed properties, the property is part of a
> > larger object.  It sounds to me like you have two arrays in your form
> > class: one for blockName and one for blockType.  I would suggest
> > creating a bean with the two properties, and then have a collection of
> > those objects in your form.
> >
> > Building on my previous example, you'd have something like this:
> >   >  type="com.myco.beans.Block">
> >  
> >
> >  
> >  
> > > indexed="true" size="1">
> >   
> > >  
> >  
> >
> > This example assumes your collection of blockTypes is part of your form,
> > but it could be a collection that was in request/session/application
> > scope.  You would create form entries for the collection like you
> > implemented in our previous emails.
> >
> > I have almost this exact code in a few places and it works well.
> >
> > Hope this helps.
> > Nick
> >
> > -Original Message-
> > From: atta-ur rehman [mailto:[EMAIL PROTECTED]
> > Sent: Monday, July 28, 2003 3:37 PM
> > To: Struts Users Mailing List
> > Subject: Re: Indexed Properties
> >
> > Thanks, for the reply.
> >
> > Okay, here is the background. I'm trying to learn the user of Indexed
> > Properties. Why I'm doing that? Well, I have a form that lists, l

RE: Indexed Properties

2003-07-29 Thread Paananen, Tero
> What i'm still missing what is updated when i submit the 
> form? where can i
> get updated values from? my ActionForm has list attirbute 
> called "blocks"
> each element in the list is a Block bean object. The
> Block bean has getter/setters for id, name and category.

Two strategies:

1. Update everything every time you submit regardless of
   whether the information changed or not

2. Keep the previous values around and compare the values
   submitted to the previous ones. Then only update the beans
   that changed. You could do this in a number of ways.

-TPP

-
This email may contain confidential and privileged material for the sole use of the 
intended recipient(s). Any review, use, retention, distribution or disclosure by 
others is strictly prohibited. If you are not the intended recipient (or authorized to 
receive for the recipient), please contact the sender by reply email and delete all 
copies of this message.  Also, email is susceptible to data corruption, interception, 
tampering, unauthorized amendment and viruses. We only send and receive emails on the 
basis that we are not liable for any such corruption, interception, tampering, 
amendment or viruses or any consequence thereof.


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



Re: Indexed Properties

2003-07-29 Thread atta-ur rehman
Thanks.

you see my problem is i don't know how to get the updated values when the
form is submitted? my beans collection is updated, my indexed getter/setter
are not called? so where are the new values or even the same values when i
submit without changing anything at all on the form?

this is my Action code that i'm using to get values:
TestForm tf = (TestForm) form;

HttpSession session = request.getSession();

if (tf != null && tf.getBlocks() != null) {

List list = tf.getBlocks();

Block block;

for (int i = 0; i < list.size(); i++) {

block = (Block) list.get(i);

System.out.println("TestAction.execute Block: " +

block.getId() + ", " + block.getName() + ", " +

block.getCategory());

}

} // if (tf != null && tf.getBlocks() != null)

but this code always prints the values that i set the first time page was
shown!



ATTA

- Original Message - 
From: "Paananen, Tero" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 10:04 AM
Subject: RE: Indexed Properties


> > What i'm still missing what is updated when i submit the
> > form? where can i
> > get updated values from? my ActionForm has list attirbute
> > called "blocks"
> > each element in the list is a Block bean object. The
> > Block bean has getter/setters for id, name and category.
>
> Two strategies:
>
> 1. Update everything every time you submit regardless of
>whether the information changed or not
>
> 2. Keep the previous values around and compare the values
>submitted to the previous ones. Then only update the beans
>that changed. You could do this in a number of ways.
>
> -TPP
>
> -
> This email may contain confidential and privileged material for the sole
use of the intended recipient(s). Any review, use, retention, distribution
or disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact the
sender by reply email and delete all copies of this message.  Also, email is
susceptible to data corruption, interception, tampering, unauthorized
amendment and viruses. We only send and receive emails on the basis that we
are not liable for any such corruption, interception, tampering, amendment
or viruses or any consequence thereof.
>
>
> -
> 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 Properties

2003-07-29 Thread Paananen, Tero
> but this code always prints the values that i set
> the first time page was shown!

Beats me...the code looked fine to me.

Maybe something wrong with your action mappings
and form bean configurations? Or the JSP the values
are changed on.

-TPP

-
This email may contain confidential and privileged material for the sole use of the 
intended recipient(s). Any review, use, retention, distribution or disclosure by 
others is strictly prohibited. If you are not the intended recipient (or authorized to 
receive for the recipient), please contact the sender by reply email and delete all 
copies of this message.  Also, email is susceptible to data corruption, interception, 
tampering, unauthorized amendment and viruses. We only send and receive emails on the 
basis that we are not liable for any such corruption, interception, tampering, 
amendment or viruses or any consequence thereof.


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



Re: Indexed Properties

2003-07-29 Thread atta-ur rehman
so you are saying that ideally the the beans collection in my ActionForm
should be updated on form submission?


- Original Message - 
From: "Paananen, Tero" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 10:30 AM
Subject: RE: Indexed Properties


> > but this code always prints the values that i set
> > the first time page was shown!
>
> Beats me...the code looked fine to me.
>
> Maybe something wrong with your action mappings
> and form bean configurations? Or the JSP the values
> are changed on.
>
> -TPP
>
> -
> This email may contain confidential and privileged material for the sole
use of the intended recipient(s). Any review, use, retention, distribution
or disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact the
sender by reply email and delete all copies of this message.  Also, email is
susceptible to data corruption, interception, tampering, unauthorized
amendment and viruses. We only send and receive emails on the basis that we
are not liable for any such corruption, interception, tampering, amendment
or viruses or any consequence thereof.
>
>
> -
> 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 Properties

2003-07-29 Thread Paananen, Tero
> so you are saying that ideally the the beans collection
> in my ActionForm should be updated on form submission?

The attribute values in the beans held in the collection
should change on form submission, yes.

-TPP

-
This email may contain confidential and privileged material for the sole use of the 
intended recipient(s). Any review, use, retention, distribution or disclosure by 
others is strictly prohibited. If you are not the intended recipient (or authorized to 
receive for the recipient), please contact the sender by reply email and delete all 
copies of this message.  Also, email is susceptible to data corruption, interception, 
tampering, unauthorized amendment and viruses. We only send and receive emails on the 
basis that we are not liable for any such corruption, interception, tampering, 
amendment or viruses or any consequence thereof.


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



Re: Indexed Properties

2003-07-29 Thread atta-ur rehman
Okay.

my form-bean definition looks like:



while the action is:


  
  


my form class extends ActionForm.

any ideas?

ATTA

- Original Message - 
From: "Paananen, Tero" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 10:43 AM
Subject: RE: Indexed Properties


> > so you are saying that ideally the the beans collection
> > in my ActionForm should be updated on form submission?
>
> The attribute values in the beans held in the collection
> should change on form submission, yes.
>
> -TPP
>
> -
> This email may contain confidential and privileged material for the sole
use of the intended recipient(s). Any review, use, retention, distribution
or disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact the
sender by reply email and delete all copies of this message.  Also, email is
susceptible to data corruption, interception, tampering, unauthorized
amendment and viruses. We only send and receive emails on the basis that we
are not liable for any such corruption, interception, tampering, amendment
or viruses or any consequence thereof.
>
>
> -
> 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 Properties

2003-07-29 Thread Nicholas L Mohler





Hi Atta

Just to clatify:
1)  You have a form that contains a "blocks" property which is a collection
of "test.Block" objects.
2)  The "test.Block" object has the following properties(get/set methods
for each): id, name, and category
3)  As we discussesed in our earlier emails, you have the get/set methods
for the "blocks" property in your form.
4)  You also have a singular "getBlock" method that takes an int (index)
and returns the "Block" object from the collection for the given index.

A couple possible causes for the error:
-  Item 4) is not implemented correctly.  You need the method shown below.
Note that since your form is in the session, you shouldn't need the
"sizing" logic.
public Block getBlock(int index) {
  while (index >= this.blocks.size()) {
this.blocks.add(new Block());
  }
  return (Block) this.blocks.get(index);
}

-  When looking at your page, look at the source and confirm that your
indexed properties are named correctly.  You should see block[0].id,
block[0].name, block[0].category.

If none of this helps, I'm not sure where else to look.  It sounds like
everything else is lining up...

Nick




   

  "atta-ur rehman" 

  <[EMAIL PROTECTED]To:   "Struts Users Mailing List" 
<[EMAIL PROTECTED]>  
  com> cc: 
        
   Subject:  Re: Indexed Properties

  07/29/2003 12:57 

  PM   

  Please respond to

  "Struts Users

  Mailing List"

   

   





Hello again Nick.

Well i've come a step forward in that i've been able to successfully show
the jsp page using index="true" for all the rows and submit the form
without
any errors too:


   

 


 


 
  
 

   
  

works like a charm!

What i'm still missing what is updated when i submit the form? where can i
get updated values from? my ActionForm has list attirbute called "blocks"
each element in the list is a Block bean object. The Block bean has
getter/setters for id, name and category.

In ActionForm I also included setCategory(int) and getCategory(int, string)
which doesn't seem to be called at all!

something obvious that i'm missing?

Thanks.

ATTA


- Original Message -----
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 2:57 AM
Subject: Re: Indexed Properties


>
>
>
>
>
> Atta,
>
> It sounds to me like you have it.  As long as your names match up, it
> should work fine.  Ajay has given a full code example that looks good.
>
> Nick
>
>
>
>
>       "atta-ur rehman"
>   <[EMAIL PROTECTED]To:   "Struts Users
Mailing List" <[EMAIL PROTECTED]>
>   com> cc:
>Subject:  Re: Indexed
Properties
>   07/28/2003 08:44
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
> Yes, I currently have two independent String arrays for blockName and
> blockType. Putting them, and all the other block related properties, is
> what
> seems to be the right thing to do! So you have confirmed.
>
> here is what i have understood from your text:
>
> 1) my form would 

Re: Indexed Properties

2003-07-29 Thread atta-ur rehman
Bingo!

The deceptive ActionForm.getBlock(int):Block was not there. Just added it
and wow!

This is opened up a whole paradigm for me. I can see how easy and manageable
code becomes not to mention its reduced size! Its just what i've been
looking for, for quite sometime! Learning new things pays, after all ;)

My sincere thanks for your help and patience! It took some time, but was
worth it!

ATTA


- Original Message - 
From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, July 29, 2003 11:19 AM
Subject: Re: Indexed Properties


>
>
>
>
>
> Hi Atta
>
> Just to clatify:
> 1)  You have a form that contains a "blocks" property which is a
collection
> of "test.Block" objects.
> 2)  The "test.Block" object has the following properties(get/set methods
> for each): id, name, and category
> 3)  As we discussesed in our earlier emails, you have the get/set methods
> for the "blocks" property in your form.
> 4)  You also have a singular "getBlock" method that takes an int (index)
> and returns the "Block" object from the collection for the given index.
>
> A couple possible causes for the error:
> -  Item 4) is not implemented correctly.  You need the method shown below.
> Note that since your form is in the session, you shouldn't need the
> "sizing" logic.
> public Block getBlock(int index) {
>   while (index >= this.blocks.size()) {
> this.blocks.add(new Block());
>   }
>   return (Block) this.blocks.get(index);
> }
>
> -  When looking at your page, look at the source and confirm that your
> indexed properties are named correctly.  You should see block[0].id,
> block[0].name, block[0].category.
>
> If none of this helps, I'm not sure where else to look.  It sounds like
> everything else is lining up...
>
> Nick
>
>
>
>
>

>   "atta-ur rehman"
>   <[EMAIL PROTECTED]To:   "Struts Users
Mailing List" <[EMAIL PROTECTED]>
>   com> cc:
>Subject:  Re: Indexed
Properties
>   07/29/2003 12:57
>   PM
>   Please respond to
>   "Struts Users
>   Mailing List"
>
>
>
>
>
>
> Hello again Nick.
>
> Well i've come a step forward in that i've been able to successfully show
> the jsp page using index="true" for all the rows and submit the form
> without
> any errors too:
>
>  type="test.Block">
>
> 
>  
> 
> 
>  
> 
> 
>  
>labelProperty="label"/>
>  
> 
>
>   
>
> works like a charm!
>
> What i'm still missing what is updated when i submit the form? where can i
> get updated values from? my ActionForm has list attirbute called "blocks"
> each element in the list is a Block bean object. The Block bean has
> getter/setters for id, name and category.
>
> In ActionForm I also included setCategory(int) and getCategory(int,
string)
> which doesn't seem to be called at all!
>
> something obvious that i'm missing?
>
> Thanks.
>
> ATTA
>
>
> - Original Message -
> From: "Nicholas L Mohler" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 29, 2003 2:57 AM
> Subject: Re: Indexed Properties
>
>
> >
> >
> >
> >
> >
> > Atta,
> >
> > It sounds to me like you have it.  As long as your names match up, it
> > should work fine.  Ajay has given a full code example that looks good.
> >
> > Nick
> >
> >
> >
> >
> >   "atta-ur rehman"
> >   <[EMAIL PROTECTED]To:   "Struts Users
> Mailing List" <[EMAIL PROTECTED]>
> >   com> cc:
> >Subject:  Re: Indexed
> Properties
> >   07/28/2003 08:44
> >   PM
> >   Please respond to
> >   "Struts Users
> >   Mailing List"
> >
> >
> >
> >
> >
> >
> > Yes, I currently have two independent String arrays for blockName and
> > blockType. Putting them, and all the other 

Indexed Properties examples?

2003-10-14 Thread Michael Blair
I am still trying to get this to work. I simply want to display records in
table format in a browser and be able to change the data, do a submit and
have access to the changes back in the action. Currently I am getting :
"HTTP ERROR: 500 No getter method for property AwardIndexed[0].safAwardCode
of bean awards"

If I can offer anymore info, please ask. Also, if anyone has a working
example of this I would love to see the snippets of the jsp, formbean and
any other relevant parts.

Mike

Here are some snippets.
.jsp -

   
   

form bean -
  private ArrayList awards;
 public void setAwardIndexed(int index, AwardMasView ob){
  System.out.println("setAward");
  this.awards.set(index, ob);
 }

 public AwardMasView getAwardIndexed(int index){
  System.out.println("getAward");
  return (AwardMasView)this.awards.get(index);
 }


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



Indexed properties help!

2003-10-26 Thread Rajat Pandit
Hello,
I am pasting some excepts from the struts documentation. It would be
really great if someone could help me clear this.

Question 1:

 The "indexed tags" feature is provided by several tags that have an
optional boolean "indexed" attribute. This is only legal when inside a
"" tag. When the "indexed" attribute is true, then the
tag will incorporate the loop index into the resulting HTML component.

The several tags that support the "indexed" attribute can be broken into
three groups, split by what they do to incorporate the loop index into
the resulting HTML component.
Group 1 Group 2 Group 3
checkboxbutton  link
fileimage
hidden  submit   
password 
radio
select   
text 
textarea 

In Group 1, all of these tags will generate an HTML "name" attribute of
"name[nn].property". The value of each tag will also be initialized by
the getter method corresponding to that property specification. 



So if I have name[nn].property, that essentially means I am creating an
array of the form. But what I really need is an array of property,
instead of the bean.

Question 2:

How should the property be declared in the the actionForm if it has to
receive an array of information.


thanks




Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]


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



indexed properties problem

2003-02-18 Thread Brian Moseley

i'm having a problem with struts' population of a form with an indexed 
property. specifically, BeanUtils.setProperty is barfing (and something 
in the stack is annoyingly swallowing the exception) when trying to set 
a nested property on the indexed property.

(see the form, jsp, generated html and log output snippets below)

this is my first real attempt at using indexed properties, so i may have 
missed something obvious. i read the user guide section and the faq page 
before starting, but that doc doesn't seem to cover precisely what i'm 
doing.

i wonder if the problem is that the IpValue[] form property has size 
zero when the bean is populated? i assumed that BeanUtils would 
instantiate the array and set it as needed, retrieving and growing it 
each time setProperty is called for the indexed field. to see if i was 
wrong, i tried using the setter signature that's found in the faq entry 
(see indexed setter snippet below), but i got the same result as before.

what am i missing? something simple, i'm sure.

thanks for your help!

== form class (relevant bits included)

public class PlatformForm extends ActionForm {

private IpValue[] ip;

public IpValue[] getIp() {
	return this.ip;
}

public void setIp(IpValue[] ip) {
this.ip = ip;
}

}

== jsp (static text removed for bretivy)


  


  


== generated html

  


  

== log output

16:17:46,936 DEBUG [BeanUtils]   setProperty(startTime=now 
startMonth=null startDay=null startYear=null startHour=00 startMin=00 
startAmPm=am startTimeZone=PST recurInterval=null 
recurrenceFrequencyDaily=everyDay numDays=1 numWeeks=1 
recurrenceDay=[Ljava.lang.Integer;@74cc4e 
recurrenceFrequencyMonthly=onDay numMonths=1 recurrenceWeek=null 
eachDay=null endTime=none endMonth=null endDay=null rid=null type=null 
name=null location=null description=null  cpuCount=null cpuSpeed=null 
dhcpServer=null dnsServer=null fqdn=null gateway= ram=null ip=[], 
ip[0].address, [10.0.1.6])

== indexed setter

public void setIp(int index, IpValue ip) {
if (this.ip == null) {
this.ip = new IpValue[0];
}

int numIps = this.ip.length;
if (index >= numIps) {
IpValue[] newIps = new IpValue[numIps+1];
System.arraycopy(this.ip, 0, newIps, 0, numIps);
this.ip = newIps;
}

this.ip[index] = ip;
}



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



Validator & Indexed Properties

2003-03-14 Thread Jim Krygowski
Hey All-

I can't seem to get the validation.xml file configured correctly so that I
can validate indexed properties.   I've done a bunch of Mailing List/Google
searches and come up dry.  I've tried to configure it as suggested by D.
Winterfeldt and P. Ginnaram, but neither approach worked.  I ended up
getting the following useless javascript function rendered:

function DateValidations () {
}

Which as you notice, contains no validations.  I've hard-coded
(field="indexed[0].value") and the javascript rendered worked perfectly.  Of
course that's useless because I don't know how many result may come back.
Matt Raible seemed to be on the same route (note that his emails to the list
post-date Winterfeldt & Ginnaram) but his last email seems to indicate that
he's going to write his own custom javascripts to handle this.

My question is, does the validator handle indexed properties as of
struts-1.1b3 (aka RC1)??? If so, how is it done?  If not, does anyone have a
workaround (Matt if you're listening...)?

Here are a few links to the discussions regarding the validator and indexed
properties:

D. Winterfeldt Thu, 13 Jun 2002
Re: Indexed Property Validation on a String[]
http://www.mail-archive.com/[EMAIL PROTECTED]/msg33752.html


P. Ginnaram Tue, 20 Aug 2002
http://www.mail-archive.com/[EMAIL PROTECTED]/msg38703.html


M Raible
Validating Indexed Properties
17 Dec 2002
http://www.mail-archive.com/[EMAIL PROTECTED]/msg51913.html

Mon, 20 Jan 2003
http://www.mail-archive.com/[EMAIL PROTECTED]/msg54868.html

Tue, 21 Jan 2003
http://www.mail-archive.com/[EMAIL PROTECTED]/msg55133.html

Brandon Goodin Sat, 01 Feb 2003
[Validator] indexed property validation
http://www.mail-archive.com/[EMAIL PROTECTED]/msg56956.html


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



Validating indexed properties

2003-01-21 Thread Raible, Matt
I'm guessing that nothing has changed since the message below on Aug. 2001.
Since this is not possible, I'm willing to write out a bunch of Javascript
to do this validation.  My question is, how do I get the mask and such from
the validator.  The validator produces the following:

function mask () { 
 this.aa = new Array("signals[1].action", "The signal '1' has an invalid
action.  Please enter +, - or nothing at all.", new Function ("varName",
"this.mask=/^(\\+|\\-|\\s)$/;  return this[varName];"));

And I want to do this, except using a new function and I'll write signals[1]
- signals[x] as variables.

Thanks,

Matt

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg13943.html

* From: David Winterfeldt
* Subject: RE: Does the Validator package work with indexed properties?
* Date: Tue, 21 Aug 2001 15:28:27 -0700 

It can, but it is the same issue as the indexed
property.  You would have to define each field.  There
isn't currently anything where you can specify
'name[x]' and have it match any index (name[0],
name[1], etc.).  Which is what you would probably want
to do.

David

--- Shamdasani Nimmi-ANS004 <[EMAIL PROTECTED]>
wrote:
> David,
> 
> What I was referring to are the tabular fields, i.e,
> multiple rows of the same kind of data (a grid). Can
> your package be used to validate those.
> 
> Thanks.
> 
> -Nimmi


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




RE: indexed properties.

2003-05-29 Thread Andrew Hill
The fields name is "name[0]" right?

So in javascript you cant use something like document.forms[0].name[0] so
you will need to use the alternative javascript notation to get at your
field:

document.forms[0].elements['name[0]']

If you need to change the way indexed fields are done in struts however, Im
afraid I dont have the answer. :-(

-Original Message-
From: Abhinav (Cognizant) [mailto:[EMAIL PROTECTED]
Sent: Thursday, 29 May 2003 17:11
To: Struts Users Mailing List
Subject: indexed properties.


Will someone please tell me how to override indexed naming (like name[0],
name[1], name[2])
in my form when my form bean has
attribute
String [] name
and methods
getName(int index), setName(int index, String nm).

thanx, coz its really urgent.
I need this b'coz i cant validate field named name[0] in javascript




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



Re: Indexed Properties

2002-02-22 Thread Arron Bates

Sridhar,

I've had to make one such application of equally nasty size. To get the 
job done the nested tags were made. They made the truly daunting task a 
walk in the park.
They're in the nightly build, or if you're confined to an earlier 
release of Struts you can get them as a separate jar here...

http://www.keyboardmonkey.com/struts

Link above will also provide a primer, tutorial, and some advanced 
tricks. The latest docco is on the nightly build part of the struts site 
documentation.

Arron.

Sridhar M wrote:

>Hi,
>  I have a requirement wherein my HTML Form contains
>around 100 textfields. I want to use struts to handle
>this form automatically. But the problem is that I
>can't define 100 setter and getter methods.I tried
>using indexed properties with form beans but did not
>succeed. 
>
>Does Struts support the indexed properties concept
>defined by Javabeans. If so how to implement it.
>
>Thanks in advance,
>Sridhar
>
>__
>Do You Yahoo!?
>Yahoo! Sports - Coverage of the 2002 Olympic Games
>http://sports.yahoo.com
>
>--
>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: Indexed Properties

2002-02-22 Thread Erik Tennant

I've had repeated problems with IE and Netscape on win9x platforms using a 
large number of text fields.  The browser display seems to become corrupt 
after a short period of time using the screens.  It might be worth your 
time to mock up some screens on your target platform(s) and make sure you 
don't encounter similar problems.

-Erik

At 08:48 AM 2/22/2002, Sridhar M wrote:
>Hi,
>   I have a requirement wherein my HTML Form contains
>around 100 textfields. I want to use struts to handle
>this form automatically. But the problem is that I
>can't define 100 setter and getter methods.I tried
>using indexed properties with form beans but did not
>succeed.
>
>Does Struts support the indexed properties concept
>defined by Javabeans. If so how to implement it.
>
>Thanks in advance,
>Sridhar
>
>__
>Do You Yahoo!?
>Yahoo! Sports - Coverage of the 2002 Olympic Games
>http://sports.yahoo.com
>
>--
>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: Indexed Properties

2002-02-22 Thread dhay


loads on this in the archive.




Sridhar M <[EMAIL PROTECTED]> on 02/22/2002 09:48:36 AM

Please respond to "Struts Users Mailing List"
  <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:
Subject:  Indexed Properties


Hi,
  I have a requirement wherein my HTML Form contains
around 100 textfields. I want to use struts to handle
this form automatically. But the problem is that I
can't define 100 setter and getter methods.I tried
using indexed properties with form beans but did not
succeed.

Does Struts support the indexed properties concept
defined by Javabeans. If so how to implement it.

Thanks in advance,
Sridhar

__
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
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: indexed properties

2002-02-26 Thread Gaulin . David

RTFM
http://jakarta.apache.org/struts/userGuide/struts-html.html

and the mailling list archive which is full of examples

http://www.mail-archive.com/struts-user@jakarta.apache.org/

Have fun!



David Gaulin
Tel / tél :(613) 946-9595 
Email / courriel : [EMAIL PROTECTED] 
Facsimile / télécopieur : (613) 954-6012
Industry Canada | 235 Queen Street, Ottawa, Ontario, K1A 0H5
Industry Canada | 235, rue Queen, Ottawa (Ontario)  K1A 0H5



-Original Message-
From: Maris Orbidans [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 26, 2002 10:06 AM
To: Struts Users Mailing List
Subject: indexed properties



How to use indexed properties?

Please, give me an URL with examples or documents.


Maris Orbidans


--
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: indexed properties

2002-02-27 Thread Arron Bates

yup.

Arron

Maris Orbidans wrote:

>hello
>
>   Do I have to use Nightly Build to get subj. ?
>
>   1.0.2 says 
>
>"Lemums1.jsp": Attribute indexed invalid according to the specified TLD
>at line 194, column 5
>
>
>
>
>
>Searched mail archive but didnt find any useful.
>
>
>Maris Orbidans
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Indexed Properties

2001-06-27 Thread dhay



Jason,

I believe you need a
 public User getUser(int index)
 {
  return (users[i]);
 }

For the examples I sent you, I have the following form:

public final class ParametersForm extends ActionForm
{
   // --- Instance Variables

   /**
* The parameter list
*/
   private Vector parameterList = new Vector();
   // --- Properties

   /**
* Return the list of parameters
*/
   public Vector getParameterList()
   {
  return(this.parameterList);
   }

   /**
* Set the list of parameters
*
* @param parameterList The new list
*/
   public void setParameterList(Vector parameterList)
   {
  this.parameterList = parameterList;
   }

   /**
* Get a particular parameter from the parameterList, based on index
*
* @param   index The index of the parameter to retrieve
*/
   public Parameter getParameter(int index)
   {
  return (Parameter)parameterList.elementAt(index);

   }
}

and I obviously have get/set methods in my Parameter object to get the parameter
 variables.

Cheers.

Dave






Jason Rosenblum <[EMAIL PROTECTED]> on 06/27/2001
12:20:51 PM

Please respond to [EMAIL PROTECTED]

To:   "'[EMAIL PROTECTED]'"
  <[EMAIL PROTECTED]>
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Indexed Properties



Hello all,

I'm trying to get my code to work with indexed properties. Thanks to Dave Hay
and his Struts tweak, I was able to generate input types like this:



using the following Struts tags:



The problem is that I cannot get my ActionForm to pick up these input fields. I
wrote several setters and getters in my ActionForm:
   /**
 * Return the users.
 */
public String getUsers(int i) {

 return (users[i].getUsername());

}


/**
 * Set a user.
 *
 * @param user
 * @param index
 */
public void setUsers(int i, String user) {
 this.users[i].setUsername(user);

}


/**
 * Return the users.
 */
public User[] getUsers() {

 return (this.users);

}


/**
 * Set a user.
 *
 * @param user list
 */
public void setUsers(User[] users) {
 this.users = users;

}

/**
 * Return the roles.
 */
public String getRoles(int i) {

 return (users[i].getRole());

}


/**
 * Set a role.
 *
 * @param role
 * @param index
 */
public void setRoles(int i, String role) {

this.users[i].setRole(role);

}


/**
 * Return the roles.
 */
public User[] getRoles() {

 return (this.users);

}


/**
 * Set a role.
 *
 * @param role list
 */
public void setRoles(User[] roles) {

this.users = users;

}


Do you see anything wrong with this scheme? Currently, the ActionForm returns
null for all items in the User[] when I call any of the get methods. Please
help.

~Jason









Re: Indexed Properties

2001-06-27 Thread David Winterfeldt

Is this all in one class?  It shouldn't even compile
if you have getUsers() returning two different types. 
Here is a snippet on using an array.

public User getUser(int index) {
   return user[index];  
}

public void setUser(int index, User user) {
   this.user[index] = user;
}


Then you could do "user[0].userName", which is the
same as "getUser(0).getUserName()" or
"getUser(0).setUserName("Joe")".

David

--- Jason Rosenblum <[EMAIL PROTECTED]> wrote:
> Hello all,
> 
> I'm trying to get my code to work with indexed
> properties. Thanks to Dave Hay and his Struts tweak,
> I was able to generate input types like this:
>  size="12" value="">
>  value="">
> 
> using the following Struts tags:
>  size="12" indexed="true"/>
>  indexed="true"/>
> 
> The problem is that I cannot get my ActionForm to
> pick up these input fields. I wrote several setters
> and getters in my ActionForm:
>/**
>  * Return the users.
>  */
> public String getUsers(int i) {
> 
>   return (users[i].getUsername());
> 
> }
> 
> 
> /**
>  * Set a user.
>  *
>  * @param user
>  * @param index
>  */
> public void setUsers(int i, String user) {
>   this.users[i].setUsername(user);
> 
> }
>  
>  
> /**
>  * Return the users.
>  */
> public User[] getUsers() {
> 
>   return (this.users);
> 
> }
> 
> 
> /**
>  * Set a user.
>  *
>  * @param user list
>  */
> public void setUsers(User[] users) {
>   this.users = users;
> 
> }
>  
> /**
>  * Return the roles.
>  */
> public String getRoles(int i) {
> 
>   return (users[i].getRole());
> 
> }
> 
> 
> /**
>  * Set a role.
>  *
>  * @param role
>  * @param index
>  */
> public void setRoles(int i, String role) {
> 
> this.users[i].setRole(role);
> 
> }
>  
>  
> /**
>  * Return the roles.
>  */
> public User[] getRoles() {
> 
>   return (this.users);
> 
> }
> 
> 
> /**
>  * Set a role.
>  *
>  * @param role list
>  */
> public void setRoles(User[] roles) {
> 
> this.users = users;
> 
> } 
> 
> 
> Do you see anything wrong with this scheme?
> Currently, the ActionForm returns null for all items
> in the User[] when I call any of the get methods.
> Please help.
> 
> ~Jason


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



RE: Indexed Properties

2001-06-27 Thread Jason Rosenblum

that did the trick.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 27, 2001 9:32 AM
To: [EMAIL PROTECTED]
Subject: Re: Indexed Properties




Jason,

I believe you need a
 public User getUser(int index)
 {
  return (users[i]);
 }

For the examples I sent you, I have the following form:

public final class ParametersForm extends ActionForm
{
   // --- Instance Variables

   /**
* The parameter list
*/
   private Vector parameterList = new Vector();
   // --- Properties

   /**
* Return the list of parameters
*/
   public Vector getParameterList()
   {
  return(this.parameterList);
   }

   /**
* Set the list of parameters
*
* @param parameterList The new list
*/
   public void setParameterList(Vector parameterList)
   {
  this.parameterList = parameterList;
   }

   /**
* Get a particular parameter from the parameterList, based on index
*
* @param   index The index of the parameter to retrieve
*/
   public Parameter getParameter(int index)
   {
  return (Parameter)parameterList.elementAt(index);

   }
}

and I obviously have get/set methods in my Parameter object to get the parameter
 variables.

Cheers.

Dave






Jason Rosenblum <[EMAIL PROTECTED]> on 06/27/2001
12:20:51 PM

Please respond to [EMAIL PROTECTED]

To:   "'[EMAIL PROTECTED]'"
  <[EMAIL PROTECTED]>
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Indexed Properties



Hello all,

I'm trying to get my code to work with indexed properties. Thanks to Dave Hay
and his Struts tweak, I was able to generate input types like this:



using the following Struts tags:



The problem is that I cannot get my ActionForm to pick up these input fields. I
wrote several setters and getters in my ActionForm:
   /**
 * Return the users.
 */
public String getUsers(int i) {

 return (users[i].getUsername());

}


/**
 * Set a user.
 *
 * @param user
 * @param index
 */
public void setUsers(int i, String user) {
 this.users[i].setUsername(user);

}


/**
 * Return the users.
 */
public User[] getUsers() {

 return (this.users);

}


/**
 * Set a user.
 *
 * @param user list
 */
public void setUsers(User[] users) {
 this.users = users;

}

/**
 * Return the roles.
 */
public String getRoles(int i) {

 return (users[i].getRole());

}


/**
 * Set a role.
 *
 * @param role
 * @param index
 */
public void setRoles(int i, String role) {

this.users[i].setRole(role);

}


/**
 * Return the roles.
 */
public User[] getRoles() {

 return (this.users);

}


/**
 * Set a role.
 *
 * @param role list
 */
public void setRoles(User[] roles) {

this.users = users;

}


Do you see anything wrong with this scheme? Currently, the ActionForm returns
null for all items in the User[] when I call any of the get methods. Please
help.

~Jason








RE: Indexed Properties

2001-06-28 Thread Rey Francois

The problem is that your getUsers() return an array of User instances while
your getUsers(int i) returns a String.
As a result the PropertyDescriptor class for the users property will
consider the User class as the type of your property, and will check the
existence of User getUsers(int i) and void setUser(int i, User user).

You must make sure that indexed and non-indexed read/write methods use the
same type.

Fr.

-Original Message-
From: Jason Rosenblum [mailto:[EMAIL PROTECTED]]
Sent: 27 June 2001 18:21
To: '[EMAIL PROTECTED]'
Subject: Indexed Properties


Hello all,

I'm trying to get my code to work with indexed properties. Thanks to Dave
Hay and his Struts tweak, I was able to generate input types like this:



using the following Struts tags:



The problem is that I cannot get my ActionForm to pick up these input
fields. I wrote several setters and getters in my ActionForm:
   /**
 * Return the users.
 */
public String getUsers(int i) {

return (users[i].getUsername());

}


/**
 * Set a user.
 *
 * @param user
 * @param index
 */
public void setUsers(int i, String user) {
this.users[i].setUsername(user);

}
 
 
/**
 * Return the users.
 */
public User[] getUsers() {

return (this.users);

}


/**
 * Set a user.
 *
 * @param user list
 */
public void setUsers(User[] users) {
this.users = users;

}
 
/**
 * Return the roles.
 */
public String getRoles(int i) {

return (users[i].getRole());

}


/**
 * Set a role.
 *
 * @param role
 * @param index
 */
public void setRoles(int i, String role) {

this.users[i].setRole(role);

}
 
 
/**
 * Return the roles.
 */
public User[] getRoles() {

return (this.users);

}


/**
 * Set a role.
 *
 * @param role list
 */
public void setRoles(User[] roles) {

this.users = users;

} 


Do you see anything wrong with this scheme? Currently, the ActionForm
returns null for all items in the User[] when I call any of the get methods.
Please help.

~Jason


The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.

http://www.capco.com
***




RE: indexed properties

2001-07-07 Thread Niall Pemberton

Cameron,

Does the Action that is run when you submit the form have "CourseList"
associated with it?

If that sorts out the issue with not finding "CourseList" then I think
"CourseList" should look like this:

public final class CourseList extends ActionForm
{
  private ArrayList courseList = new ArrayList(6);

 public ArrayList getCourseList() {
  return(this.courseList);
 }

 public void setCourseList(ArrayList courseList) {
  this.courseList = courseList;
 }

 public CourseForm getCourseList(int index) {
  return (CourseForm)courseList.get(index);
 }

}

Then in your "CourseForm" bean you need setters for all the properties (i.e.
crstitle, crsdept, crshrs, crsnum).

Niall



-Original Message-
From: cahana [mailto:[EMAIL PROTECTED]]
Sent: 07 July 2001 21:40
To: [EMAIL PROTECTED]
Subject: indexed properties


Hi everyone-

    I need some help on using the indexed properties for html:text option.
I've implemented Dave Hay's modification and can get the input boxes to show
up using the iterate tag.


 
<%= courseNumber++ %>
 
 
 
 
 
 

This is what my CourseList bean looks like:

public final class CourseList extends ActionForm
{
  private ArrayList courseList = new ArrayList(6);

 public ArrayList getCourseList() {
  return(this.courseList);
 }

 public void setCourseList(ArrayList courseList) {
  this.courseList = courseList;
 }

 public CourseForm getCourseForm(int index) {
  return (CourseForm)courseList.get(index);
 }

 public void setCourseForm(int index, CourseForm course) {
  this.courseList.add(index, course);
 }
}

The problem i have is that when i try to submit the information and try to
access CourseList.getCourseList(), it bombs and says CourseList cannot be
found. The scope is request. I tried putting it in the session and can
access it that way but it doesn't have the changes that were made on the
form. Anybody know what i'm doing wrong?

thanks,
cameron




Re: indexed properties

2001-07-07 Thread cahana

In my struts-config.xml, i have CourseList as the form associated with the
Action to submit.  I also put a  for CourseList in the jsp. But
it still doesn't work. I'll keep trying.

Do you know if there is a way to associate mulitple forms with a single
action in the struts-config.xml file i.e.

  



Cameron
- Original Message -
From: "Niall Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 11:10 AM
Subject: RE: indexed properties


> Cameron,
>
> Does the Action that is run when you submit the form have "CourseList"
> associated with it?
>
> If that sorts out the issue with not finding "CourseList" then I think
> "CourseList" should look like this:
>
> public final class CourseList extends ActionForm
> {
>   private ArrayList courseList = new ArrayList(6);
>
>  public ArrayList getCourseList() {
>   return(this.courseList);
>  }
>
>  public void setCourseList(ArrayList courseList) {
>   this.courseList = courseList;
>  }
>
>  public CourseForm getCourseList(int index) {
>   return (CourseForm)courseList.get(index);
>  }
>
> }
>
> Then in your "CourseForm" bean you need setters for all the properties
(i.e.
> crstitle, crsdept, crshrs, crsnum).
>
> Niall
>
>
>
> -Original Message-
> From: cahana [mailto:[EMAIL PROTECTED]]
> Sent: 07 July 2001 21:40
> To: [EMAIL PROTECTED]
> Subject: indexed properties
>
>
> Hi everyone-
>
> I need some help on using the indexed properties for html:text option.
> I've implemented Dave Hay's modification and can get the input boxes to
show
> up using the iterate tag.
>
> 
>  
> <%= courseNumber++ %>
>   maxlength="50" indexed="true"/>
>   indexed="true"/>
>   indexed="true"/>
>   indexed="true"/>
>  
>  
>
> This is what my CourseList bean looks like:
>
> public final class CourseList extends ActionForm
> {
>   private ArrayList courseList = new ArrayList(6);
>
>  public ArrayList getCourseList() {
>   return(this.courseList);
>  }
>
>  public void setCourseList(ArrayList courseList) {
>   this.courseList = courseList;
>  }
>
>  public CourseForm getCourseForm(int index) {
>   return (CourseForm)courseList.get(index);
>  }
>
>  public void setCourseForm(int index, CourseForm course) {
>   this.courseList.add(index, course);
>  }
> }
>
> The problem i have is that when i try to submit the information and try to
> access CourseList.getCourseList(), it bombs and says CourseList cannot be
> found. The scope is request. I tried putting it in the session and can
> access it that way but it doesn't have the changes that were made on the
> form. Anybody know what i'm doing wrong?
>
> thanks,
> cameron
>




Re: indexed properties

2001-07-07 Thread cahana

Niall-

Thanks i got the CourseList to work.

Cameron

- Original Message -
From: "Niall Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 11:10 AM
Subject: RE: indexed properties


> Cameron,
>
> Does the Action that is run when you submit the form have "CourseList"
> associated with it?
>
> If that sorts out the issue with not finding "CourseList" then I think
> "CourseList" should look like this:
>
> public final class CourseList extends ActionForm
> {
>   private ArrayList courseList = new ArrayList(6);
>
>  public ArrayList getCourseList() {
>   return(this.courseList);
>  }
>
>  public void setCourseList(ArrayList courseList) {
>   this.courseList = courseList;
>  }
>
>  public CourseForm getCourseList(int index) {
>   return (CourseForm)courseList.get(index);
>  }
>
> }
>
> Then in your "CourseForm" bean you need setters for all the properties
(i.e.
> crstitle, crsdept, crshrs, crsnum).
>
> Niall
>
>
>





Re: Indexed properties

2001-07-25 Thread dhay



Nathan,

Hi.  Currently you have to use my changed tags...but it looks like they will be
in the nightly build by the end of the week.

You can get them at http://husted.com/about/struts/indexed-tags.htm, and I
attached some example source code to a previous message which was just
mentioned, if you want to look at that.

Cheers,

Dave





Nathan Coast <[EMAIL PROTECTED]> on 07/25/2001
03:53:12 AM

Please respond to [EMAIL PROTECTED]

To:   "Struts-User (E-mail)"
  <[EMAIL PROTECTED]>
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Indexed properties



Hi,

What I want to do is to have multiple text fields in a table get assigned to
an array or collection property in an ActionForm.

I've followed a few threads in the newsgroups about this and have tried some
jsp code:







but this produces this jsp error:

/pages/test/TestIndexedPropertyPage_Body.jsp(11): for tag 'text' handler
type 'org.apache.struts.taglib.html.TextTag' has no property 'indexed'

Is the "indexed" property a non-standard struts patch / extension I have to
use?

Thanks
Nathan


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**









Re: Indexed properties

2001-07-25 Thread James Howe

At 02:23 PM 7/25/2001 -0400, you wrote:


>Nathan,
>
>Hi.  Currently you have to use my changed tags...but it looks like they 
>will be
>in the nightly build by the end of the week.
>
>You can get them at http://husted.com/about/struts/indexed-tags.htm, and I
>attached some example source code to a previous message which was just
>mentioned, if you want to look at that.
>
>Cheers,
>
>Dave

I have a couple of questions about your mods.  At our site we are using a 
different set of modifications, posted by some other Struts user which 
seems to accomplish the same thing as your mods.  The major difference 
seems to be that yours requires an additional attribute to specify that the 
particular input field is to use an indexed property accessor.  I'm curious 
as to why you made this choice?  The mods we are using automatically use an 
indexed accessor if the input field is contained inside of an iterate 
tag.  Do you have an example of when you would have an input field inside 
of an iterate tag when you wouldn't want to use an indexed property 
name?  (I'm not trying to argue with your decision, just trying to get a 
better understanding of your thoughts).  The other issue, which we just 
came across today, with the other indexed property mod, is that it would 
fail to work correctly if you had iterators inside of iterators.  We had a 
case where we used an iterator to access a collection of beans, and then 
iterated over the contents of each of the beans.  The resultant HTML needed 
to look like this to work correctly:



Will your mods handle nested iterators correctly?

Finally, are your mods going to be part of the official build, or are they 
included in some sort of user supplied extensions?  I missed the original 
discussion about your modifications.

Thanks!
James W. Howe   mailto:[EMAIL PROTECTED]
Allen Creek Software, Inc.  pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103




Re: Indexed properties

2001-07-25 Thread dhay



Hi James,

Thanks for your note - made me think a bit!

Would be interested in knowing more about the other indexed tags that were
posted and you are using.  I know either Jeff Trent or Martin Cooper had
produced some tags which had a different name ie IndexedXXXTag.

My plan was to make changes to the original struts tags so that the changes
could make it into the build.  That happened last night (though they won't be
working until tonigh's build).  As to automatically adding the indexed names if
within an iterate tag, there are some where this isn't always appropriate, such
as the link tag (adds a parameter to the link set to current iteration index
value - you can also set the name of this param with indexId='x').  Like you, I
can't think of any time you wouldn't need indexed names for the other tags, but
I guess the extra param keeps them all the same?

Have just tried the iteration with an iteration, and the changes I made don't
take account of any other outer iteration (ie you just get indexed names for the
innermost iteration).  I'm sure people would welcome you making changes that
would do this!!

Cheers,

Dave







James Howe <[EMAIL PROTECTED]> on 07/25/2001 03:12:35 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Re: Indexed properties



At 02:23 PM 7/25/2001 -0400, you wrote:


>Nathan,
>
>Hi.  Currently you have to use my changed tags...but it looks like they
>will be
>in the nightly build by the end of the week.
>
>You can get them at http://husted.com/about/struts/indexed-tags.htm, and I
>attached some example source code to a previous message which was just
>mentioned, if you want to look at that.
>
>Cheers,
>
>Dave

I have a couple of questions about your mods.  At our site we are using a
different set of modifications, posted by some other Struts user which
seems to accomplish the same thing as your mods.  The major difference
seems to be that yours requires an additional attribute to specify that the
particular input field is to use an indexed property accessor.  I'm curious
as to why you made this choice?  The mods we are using automatically use an
indexed accessor if the input field is contained inside of an iterate
tag.  Do you have an example of when you would have an input field inside
of an iterate tag when you wouldn't want to use an indexed property
name?  (I'm not trying to argue with your decision, just trying to get a
better understanding of your thoughts).  The other issue, which we just
came across today, with the other indexed property mod, is that it would
fail to work correctly if you had iterators inside of iterators.  We had a
case where we used an iterator to access a collection of beans, and then
iterated over the contents of each of the beans.  The resultant HTML needed
to look like this to work correctly:



Will your mods handle nested iterators correctly?

Finally, are your mods going to be part of the official build, or are they
included in some sort of user supplied extensions?  I missed the original
discussion about your modifications.

Thanks!
James W. Howe   mailto:[EMAIL PROTECTED]
Allen Creek Software, Inc.  pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103










Re: Indexed properties

2001-07-25 Thread James Howe

At 05:20 PM 7/25/2001 -0400, you wrote:


>Hi James,
>
>Thanks for your note - made me think a bit!
>
>Would be interested in knowing more about the other indexed tags that were
>posted and you are using.  I know either Jeff Trent or Martin Cooper had
>produced some tags which had a different name ie IndexedXXXTag.

I believe the mods we have are based on those posted by Niall 
Pemberton.  In those mods, a handful of HTML tags had their doStartTag() 
method modified to be changed from:

results.append(" name=\"");
results.append(this.property);

to

results.append(" name=\"");
results.append(propertyName());

where propertyName() was implemented like this:

protected String propertyName() {
 IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, 
IterateTag.class);
 return iterateTag == null
 ? this.property
 : iterateTag.getProperty() + "[" + 
iterateTag.getIndex() + "]." + this.property;
}

In the original mods that we had, the getProperty method of IterateTag 
simply returned the property field value.  I modified it to invoke a 
propertyName() method whose implementation is the same as that given 
above.  This allows for a recursive buildup of indexed property fields when 
an HTML tag is included inside of any number of nested iterate tags.


James W. Howe   mailto:[EMAIL PROTECTED]
Allen Creek Software, Inc.  pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103




RE: Indexed properties

2001-07-26 Thread Mark Mahieu

> Is the "indexed" property a non-standard struts patch / extension I have
to
> use?
> 
> Thanks 
> Nathan

It is non-standard (for Struts 1.0 anyway).  Have a look at
http://husted.com/about/struts/indexed-tags.htm

Best regards,

Mark Mahieu



Re: Indexed properties

2001-07-26 Thread dhay



Hi James,

Do think that it is important that the indexed tags handle any level of
iteration.  The changes I made were implemented a little differently, but I will
look to adjust them so they do, along similar lines as your changes.  It will be
a couple of weeks though, as I leave on vacation tomorrow!

Thanks for your comments,

Cheers,

Dave





James Howe <[EMAIL PROTECTED]> on 07/25/2001 05:44:44 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: Indexed properties



At 05:20 PM 7/25/2001 -0400, you wrote:


>Hi James,
>
>Thanks for your note - made me think a bit!
>
>Would be interested in knowing more about the other indexed tags that were
>posted and you are using.  I know either Jeff Trent or Martin Cooper had
>produced some tags which had a different name ie IndexedXXXTag.

I believe the mods we have are based on those posted by Niall
Pemberton.  In those mods, a handful of HTML tags had their doStartTag()
method modified to be changed from:

results.append(" name=\"");
results.append(this.property);

to

results.append(" name=\"");
results.append(propertyName());

where propertyName() was implemented like this:

protected String propertyName() {
 IterateTag iterateTag = (IterateTag) findAncestorWithClass(this,
IterateTag.class);
 return iterateTag == null
 ? this.property
 : iterateTag.getProperty() + "[" +
iterateTag.getIndex() + "]." + this.property;
}

In the original mods that we had, the getProperty method of IterateTag
simply returned the property field value.  I modified it to invoke a
propertyName() method whose implementation is the same as that given
above.  This allows for a recursive buildup of indexed property fields when
an HTML tag is included inside of any number of nested iterate tags.


James W. Howe   mailto:[EMAIL PROTECTED]
Allen Creek Software, Inc.  pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103










Re: Indexed Properties

2002-01-22 Thread Jonathan James

Yes, that can be done currently with 1.0 or 1.0.1 using the multibox tag.
Look through the archive and at the docs for multibox. If you still need
more help, let us know.

-Jonathan

- Original Message -
From: "Marcus Brito" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 22, 2002 4:57 AM
Subject: Indexed Properties

Hello, folks. I'm currently using Struts 1.0.1 and was wondering if
there is a way to use indexed properties in ActionForm classes.

I know there is support for this in HEAD, but I'm coding an
enterprise-critical application and I hope not to use 'bleeding edge'
components.

I'll give an example of my need: I have a form dinamically generated
using  that contains a checkbox for each iteration. Now I
need an action to process the whole form. As of now, the Action is
defined as having no associated ActionForm, and the perform() method
usess request.getParameterValues() calls to get the form values. There
is a way to do this using ActionForms?

--
Ja ne,
   Pazu
   mailto: [EMAIL PROTECTED]

Anime Gaiden: de fãs para fãs, sempre.



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




Re: Indexed Properties

2002-01-22 Thread Marcus Brito

Em Ter, 2002-01-22 às 10:57, Jonathan James escreveu:
> Yes, that can be done currently with 1.0 or 1.0.1 using the multibox tag.
> Look through the archive and at the docs for multibox. If you still need
> more help, let us know.

I mentioned the checkbox as an example. There aro other forms controls
for each iteration: 2 text inputs.

So, for each iteration I've got a checkbox and 2 input fields. The
number of iterations is variable (it's the number of records in the DB).
And I need a struts action to process them all.

-- 
Ja ne,
   Pazu
   mailto: [EMAIL PROTECTED]

Anime Gaiden: de fãs para fãs, sempre.



signature.asc
Description: This is a digitally signed message part


RE: Indexed Properties

2002-01-22 Thread Tom Klaasen (TeleRelay)

> -Original Message-
> From: Marcus Brito [mailto:[EMAIL PROTECTED]] 
> Sent: dinsdag 22 januari 2002 11:57
> To: Struts Users Mailing List
> Subject: Indexed Properties
> 
> 
> Hello, folks. I'm currently using Struts 1.0.1 and was wondering if
> there is a way to use indexed properties in ActionForm classes. 
> 
> I know there is support for this in HEAD, but I'm coding an
> enterprise-critical application and I hope not to use 'bleeding edge'
> components.
> 
> I'll give an example of my need: I have a form dinamically generated
> using  that contains a checkbox for each 
> iteration. Now I
> need an action to process the whole form. As of now, the Action is
> defined as having no associated ActionForm, and the perform() method
> usess request.getParameterValues() calls to get the form values. There
> is a way to do this using ActionForms?

I recommend using the taglib from http://www.keyboardmonkey.com/struts
if I were you. This does not force you to use the "bleeding-edge" struts
version, but I think there's less chance that you'll encounter bugs than
if you would try this on an "on-the-fly" basis for your own webapp via
ActionForms (I tried both. The ActionForm way was *very* error-prone).

FWIW,
tomK

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




Validating indexed properties?

2002-04-30 Thread @Basebeans.com

Subject: Validating indexed properties?
From: Jose Quinteiro <[EMAIL PROTECTED]>
 ===
Say I have a JSP like this:


...


...


"someBean" has a method getRows() that returns a Collection. This 
Collection has a method getRow(int) which returns an object with methods 
getSomeProperty(), and getSomeOtherProperty().

In validate.xml I have:

...


The preceding does not work. However, this does work (i.e., it validates 
the first someProperty):

...

What am I doing wrong?


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




String indexed properties

2002-07-12 Thread [EMAIL PROTECTED]

I added support for tags to access properties throught a string index;
in practice you can access to a bean method like 'getContents(String
index)' using a tag like ''. If anybody is interested in, mail me to [EMAIL PROTECTED]


Indexed properties and JavaScript

2003-06-25 Thread Fabiano de O. Lucchese
Hi All,

I've been trying to develop a Struts based web site
and got stuck by the following problem: I have defined
a form bean that contains indexed properties; thus,
I'm supposed to use squared brackets "[x]" to refer to
the individual elements of each of these "array-like
properties" into my HTML/JSP page; on the other hand,
I also had to embbed some javascript code in this page
in order to enlighten the server-side processing. The
problem is that I just can't use javascript code along
with "array-like properties" because the brackets used
by them seem to conflict with the javascript syntax.

The following sample code reproduces this problem:



test










and the error message is something like:
"document.testForm.att.0 is null or is not an object".

One should notice that when the index reference [0] is
deleted, the page works fine.

Does anyone here has any experience with this problem
?

Thanks in advance.

FLu-X


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



Validation of Indexed Properties

2003-07-28 Thread Nicholas L Mohler




Hi,

I am currently imple,enting the Struts validator into our web app.  All is
going pretty well with the exception of client-side indexed property
validation.  I have looked at the Validator documentation, and gone through
this list looking for some idea that will give me a clue as to what I am
doing wrong.  I have not been able to find anything that makes this work.

I would appreciate any help or direction.

Nick

Code snippets from the various objects that are involved:
struts-config:
   
  
   

validation.xml:
   
  
   


jsp:
   
  
 

 
  
   

BeanUtils.Populate exception(Indexed Properties)

2003-08-11 Thread Sridhar Kotagiri
1)I have an arraylist called alist which contain collection of Beans(IpAddress)
  I provided the getter and setter methods for alist and getIpAddress(int index) and 
setIpAddress(int index,IpAddress ip) for the bean.
2)This bean has two properties domainName and ipValue,wrote the getter and setter 
methods for this
3)
  
  
 
  


   



4)Now Im able to diplay in the jsp page but when I submit this page its throwing 
javax.servlet.ServletException: BeanUtils.populate at 
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1098)  exception.


Thanks!
Sridhar


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



RE: Indexed Properties examples?

2003-10-14 Thread Karr, David
Try changing the property value reference in your JSP to reference
"awardIndexed" instead of "AwardIndexed".  That might help, but I'm not
certain.

> -Original Message-
> From: Michael Blair [mailto:[EMAIL PROTECTED] 
> 
> I am still trying to get this to work. I simply want to 
> display records in
> table format in a browser and be able to change the data, do 
> a submit and
> have access to the changes back in the action. Currently I am 
> getting :
> "HTTP ERROR: 500 No getter method for property 
> AwardIndexed[0].safAwardCode
> of bean awards"
> 
> If I can offer anymore info, please ask. Also, if anyone has a working
> example of this I would love to see the snippets of the jsp, 
> formbean and
> any other relevant parts.
> 
> Mike
> 
> Here are some snippets.
> .jsp -
>  id="awards"
> scope="session" indexId="ctr">
>
>
> 
> form bean -
>   private ArrayList awards;
>  public void setAwardIndexed(int index, AwardMasView ob){
>   System.out.println("setAward");
>   this.awards.set(index, ob);
>  }
> 
>  public AwardMasView getAwardIndexed(int index){
>   System.out.println("getAward");
>   return (AwardMasView)this.awards.get(index);
>  }

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



Re: Indexed Properties examples?

2003-10-21 Thread hsc
i have same question as you , do you have get right answer?
my resolve is like this :

form bean -
  private ArrayList awards = new ArrayList (5);
  public void reset(ActionMapping actionMapping, HttpServletRequest
httpServletRequest) {
awards .add(0,new AwardMasView ());
awards .add(1,new AwardMasView ());
awards .add(2,new AwardMasView ());
awards .add(3,new AwardMasView ());
awards .add(4,new AwardMasView ());
  }

the program can right work, but ArrayList's length is fixed .

if you have get right answer ,would you maind share whit me.




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



RE: Indexed Properties examples?

2003-10-21 Thread shirishchandra.sakhare
Search the user archive...
This question has been answered many times(Use of lazy lists is one of the ways to 
manange the list runtime..)

-Original Message-
From: hsc [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 9:29 AM
To: [EMAIL PROTECTED]
Subject: Re: Indexed Properties examples?


i have same question as you , do you have get right answer?
my resolve is like this :

form bean -
  private ArrayList awards = new ArrayList (5);
  public void reset(ActionMapping actionMapping, HttpServletRequest
httpServletRequest) {
awards .add(0,new AwardMasView ());
awards .add(1,new AwardMasView ());
awards .add(2,new AwardMasView ());
awards .add(3,new AwardMasView ());
awards .add(4,new AwardMasView ());
  }

the program can right work, but ArrayList's length is fixed .

if you have get right answer ,would you maind share whit me.




-
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 Properties examples?

2003-10-21 Thread Benz Lim
try looking at www.keyboardmonkey.com

I believe the example on nested tag will help you...

Best Regards,
Benz Lim

-Original Message-
From: hsc [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 21, 2003 3:29 PM
To: [EMAIL PROTECTED]
Subject: Re: Indexed Properties examples?


i have same question as you , do you have get right answer?
my resolve is like this :

form bean -
  private ArrayList awards = new ArrayList (5);
  public void reset(ActionMapping actionMapping, HttpServletRequest
httpServletRequest) {
awards .add(0,new AwardMasView ());
awards .add(1,new AwardMasView ());
awards .add(2,new AwardMasView ());
awards .add(3,new AwardMasView ());
awards .add(4,new AwardMasView ());
  }

the program can right work, but ArrayList's length is fixed .

if you have get right answer ,would you maind share whit me.




-
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 Properties examples?

2003-10-21 Thread Frederic Dernbach
OK, I faced the same problems you a few weeks ago (I was a total newbee
with indexed properties and I spent 10 full days on the problem - I'm
still hot on this one !).

I haven't read the initial post and I hope my input will be useful to
you.

Regarding the form :
1/ I create an empty array list in the constructor :
ArrayList awards = new ArrayList();

2/ I do the same in the reset() method. Create the an empty ArrayList.
Do not set the list to null items like you proposed, otherwise you will
have problems with the BeanUtils.populate() method when forwarding a
struts request.Reset the list elements to null only for boolean
elements.

3/ Have the following the setter and getter methods in your form (and
perform laying list initialization for the 'Award' form property) :
public ArrayList getAwards() {
return awards
}
public void setAwards (ArrayList awards) {
this.awards = awards;
}

public AwardMasView getAward(int index) {
while( index >= awards.size() ){
awards.add(new AwardMasView());
}
return (AwardLasView) awards.get(index);
}
public void setAward(int index, AwardMasView object) {
while ( index >= awards.size() ){
awards.add(new AwardMasView());
}
awards.set(index, object);
}

In a JSp you can now use tboth the 'Awards' and 'Award' form property
('Award' being the INDEXED property) :







Note that the 'id' attribute of the  has to be equal to
the name of your indexed property ('Award').

And do not forget to include every indexed property in your form (liek
the example above) if you are using  tag to display your
indexed property, otherwise you will have problems with
BeanUtils.populate() methods.

Cheers,

Fred


Le mar 21/10/2003 à 09:29, hsc a écrit :
> i have same question as you , do you have get right answer?
> my resolve is like this :
> 
> form bean -
>   private ArrayList awards = new ArrayList (5);
>   public void reset(ActionMapping actionMapping, HttpServletRequest
> httpServletRequest) {
> awards .add(0,new AwardMasView ());
> awards .add(1,new AwardMasView ());
> awards .add(2,new AwardMasView ());
> awards .add(3,new AwardMasView ());
> awards .add(4,new AwardMasView ());
>   }
> 
> the program can right work, but ArrayList's length is fixed .
> 
> if you have get right answer ,would you maind share whit me.
> 
> 
> 
> 
> -
> 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 Properties examples?

2003-10-21 Thread Mark Lowe
If you're using struts 1.1 you can define a form property as an 
arrayList to do the same thing..


...

ArrayList myList = new ArrayList()

theForm.set("myproperty",myList);



..

..

Cheers Mark

On Tuesday, October 21, 2003, at 12:33 PM, Frederic Dernbach wrote:

OK, I faced the same problems you a few weeks ago (I was a total newbee
with indexed properties and I spent 10 full days on the problem - I'm
still hot on this one !).
I haven't read the initial post and I hope my input will be useful to
you.
Regarding the form :
1/ I create an empty array list in the constructor :
ArrayList awards = new ArrayList();
2/ I do the same in the reset() method. Create the an empty ArrayList.
Do not set the list to null items like you proposed, otherwise you will
have problems with the BeanUtils.populate() method when forwarding a
struts request.Reset the list elements to null only for boolean
elements.
3/ Have the following the setter and getter methods in your form (and
perform laying list initialization for the 'Award' form property) :
public ArrayList getAwards() {
return awards
}
public void setAwards (ArrayList awards) {
this.awards = awards;
}
public AwardMasView getAward(int index) {
while( index >= awards.size() ){
awards.add(new AwardMasView());
}
return (AwardLasView) awards.get(index);
}
public void setAward(int index, AwardMasView object) {
while ( index >= awards.size() ){
awards.add(new AwardMasView());
}
awards.set(index, object);
}
In a JSp you can now use tboth the 'Awards' and 'Award' form property
('Award' being the INDEXED property) :





Note that the 'id' attribute of the  has to be equal to
the name of your indexed property ('Award').
And do not forget to include every indexed property in your form (liek
the example above) if you are using  tag to display your
indexed property, otherwise you will have problems with
BeanUtils.populate() methods.
Cheers,

Fred

Le mar 21/10/2003 à 09:29, hsc a écrit :
i have same question as you , do you have get right answer?
my resolve is like this :
form bean -
  private ArrayList awards = new ArrayList (5);
  public void reset(ActionMapping actionMapping, HttpServletRequest
httpServletRequest) {
awards .add(0,new AwardMasView ());
awards .add(1,new AwardMasView ());
awards .add(2,new AwardMasView ());
awards .add(3,new AwardMasView ());
awards .add(4,new AwardMasView ());
  }
the program can right work, but ArrayList's length is fixed .

if you have get right answer ,would you maind share whit me.



-
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 properties help!

2003-10-26 Thread Rajat Pandit
Hello fred,
Thanks for the  reply, so just for clarifiation, if I am using a
property which will be "indexed" then the getters and setters will be a
little different from the usual set and get
Ie

public String getBidAmount(int index) {
return bidAmount[index];
}

And 
public  void setBidAmount(int index, String val) {
bidAmount[index] = val;
}

And have to implement the bidAmoutn as an array?
Protected String[] bidAmount;

Do confirm if igot that right?
Thanks once again for ur time.


-Original Message-
From: Frederic Dernbach [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 26, 2003 8:23 AM
To: Struts Users Mailing List
Subject: Re: Indexed properties help!


Rajat,

Here is an example of an indexed property called 'signal' (in my
application it holds complex objects, not simple strings or integers):

public OrderedSignalBean getSignal(int index) {
while( index >= this.getSignals().size() ){
this.getSignals().add(new OrderedSignalBean());
}
return (OrderedSignalBean) this.getSignals().get(index);
}

public void setSignal(int index, OrderedSignalBean signal) {
while ( index >= signals.size() ){
signals.add(new OrderedSignalBean());
}
signals.set(index, signal);
}

The 'signals' member is private and is of type 'ArrayList'. It is
created in the form's contructor and the reset method of the form :
signals = new ArrayList().

The setter and getter methods of the indexed property perform so-clled
"lazy-initialization" so you do not have to worry about the siez of the
array list.

Hope this helps.

Fred 


Le dim 26/10/2003 à 16:54, Rajat Pandit a écrit :
> Hello,
> I am pasting some excepts from the struts documentation. It would be 
> really great if someone could help me clear this.
> 
> Question 1:
> 
>  The "indexed tags" feature is provided by several tags that have an 
> optional boolean "indexed" attribute. This is only legal when inside a

> "" tag. When the "indexed" attribute is true, then the 
> tag will incorporate the loop index into the resulting HTML component.
> 
> The several tags that support the "indexed" attribute can be broken 
> into three groups, split by what they do to incorporate the loop index

> into the resulting HTML component.
> Group 1   Group 2 Group 3
> checkbox  button  link
> file  image
> hiddensubmit   
> password   
> radio  
> select 
> text   
> textarea   
> 
> In Group 1, all of these tags will generate an HTML "name" attribute 
> of "name[nn].property". The value of each tag will also be initialized

> by the getter method corresponding to that property specification. 
> 
> 
> 
> So if I have name[nn].property, that essentially means I am creating 
> an array of the form. But what I really need is an array of property, 
> instead of the bean.
> 
> Question 2:
> 
> How should the property be declared in the the actionForm if it has to

> receive an array of information.
> 
> 
> thanks
> 
> 
> 
> 
> Rajat Pandit | [EMAIL PROTECTED]
> +91 612 3117606
> [ Developer and Part Time Human Being]
> 
> 
> -
> 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 properties help!

2003-10-26 Thread Frederic Dernbach
Looks OK.

However, I would not use a basic array  (private members) but ArrayList,
HashMap or LinkedList, etc.

I did not manage to have arrays working (the lazy initialization
failed).

You will have problems in JSPs.


Le dim 26/10/2003 Ã 18:04, Rajat Pandit a Ãcrit :
> Hello fred,
> Thanks for the  reply, so just for clarifiation, if I am using a
> property which will be "indexed" then the getters and setters will be a
> little different from the usual set and get
> Ie
> 
> public String getBidAmount(int index) {
>   return bidAmount[index];
> }
> 
> And 
> public  void setBidAmount(int index, String val) {
>   bidAmount[index] = val;
> }
> 
> And have to implement the bidAmoutn as an array?
> Protected String[] bidAmount;
> 
> Do confirm if igot that right?
> Thanks once again for ur time.
> 
> 
> -Original Message-
> From: Frederic Dernbach [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, October 26, 2003 8:23 AM
> To: Struts Users Mailing List
> Subject: Re: Indexed properties help!
> 
> 
> Rajat,
> 
> Here is an example of an indexed property called 'signal' (in my
> application it holds complex objects, not simple strings or integers):
> 
>   public OrderedSignalBean getSignal(int index) {
>   while( index >= this.getSignals().size() ){
>   this.getSignals().add(new OrderedSignalBean());
>   }
>   return (OrderedSignalBean) this.getSignals().get(index);
>   }
> 
>   public void setSignal(int index, OrderedSignalBean signal) {
>   while ( index >= signals.size() ){
>   signals.add(new OrderedSignalBean());
>   }
>   signals.set(index, signal);
>   }
> 
> The 'signals' member is private and is of type 'ArrayList'. It is
> created in the form's contructor and the reset method of the form :
> signals = new ArrayList().
> 
> The setter and getter methods of the indexed property perform so-clled
> "lazy-initialization" so you do not have to worry about the siez of the
> array list.
> 
> Hope this helps.
> 
> Fred 
> 
> 
> Le dim 26/10/2003 Ã 16:54, Rajat Pandit a Ãcrit :
> > Hello,
> > I am pasting some excepts from the struts documentation. It would be 
> > really great if someone could help me clear this.
> > 
> > Question 1:
> > 
> >  The "indexed tags" feature is provided by several tags that have an 
> > optional boolean "indexed" attribute. This is only legal when inside a
> 
> > "" tag. When the "indexed" attribute is true, then the 
> > tag will incorporate the loop index into the resulting HTML component.
> > 
> > The several tags that support the "indexed" attribute can be broken 
> > into three groups, split by what they do to incorporate the loop index
> 
> > into the resulting HTML component.
> > Group 1 Group 2 Group 3
> > checkboxbutton  link
> > fileimage
> > hidden  submit   
> > password 
> > radio
> > select   
> > text 
> > textarea 
> > 
> > In Group 1, all of these tags will generate an HTML "name" attribute 
> > of "name[nn].property". The value of each tag will also be initialized
> 
> > by the getter method corresponding to that property specification. 
> > 
> > 
> > 
> > So if I have name[nn].property, that essentially means I am creating 
> > an array of the form. But what I really need is an array of property, 
> > instead of the bean.
> > 
> > Question 2:
> > 
> > How should the property be declared in the the actionForm if it has to
> 
> > receive an array of information.
> > 
> > 
> > thanks
> > 
> > 
> > 
> > 
> > Rajat Pandit | [EMAIL PROTECTED]
> > +91 612 3117606
> > [ Developer and Part Time Human Being]
> > 
> > 
> > -
> > 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 properties help!

2003-10-26 Thread Frederic Dernbach
Rajat,

Here is an example of an indexed property called 'signal' (in my
application it holds complex objects, not simple strings or integers):

public OrderedSignalBean getSignal(int index) {
while( index >= this.getSignals().size() ){
this.getSignals().add(new OrderedSignalBean());
}
return (OrderedSignalBean) this.getSignals().get(index);
}

public void setSignal(int index, OrderedSignalBean signal) {
while ( index >= signals.size() ){
signals.add(new OrderedSignalBean());
}
signals.set(index, signal);
}

The 'signals' member is private and is of type 'ArrayList'. It is
created in the form's contructor and the reset method of the form :
signals = new ArrayList().

The setter and getter methods of the indexed property perform so-clled
"lazy-initialization" so you do not have to worry about the siez of the
array list.

Hope this helps.

Fred 


Le dim 26/10/2003 Ã 16:54, Rajat Pandit a Ãcrit :
> Hello,
> I am pasting some excepts from the struts documentation. It would be
> really great if someone could help me clear this.
> 
> Question 1:
> 
>  The "indexed tags" feature is provided by several tags that have an
> optional boolean "indexed" attribute. This is only legal when inside a
> "" tag. When the "indexed" attribute is true, then the
> tag will incorporate the loop index into the resulting HTML component.
> 
> The several tags that support the "indexed" attribute can be broken into
> three groups, split by what they do to incorporate the loop index into
> the resulting HTML component.
> Group 1   Group 2 Group 3
> checkbox  button  link
> file  image
> hiddensubmit   
> password   
> radio  
> select 
> text   
> textarea   
> 
> In Group 1, all of these tags will generate an HTML "name" attribute of
> "name[nn].property". The value of each tag will also be initialized by
> the getter method corresponding to that property specification. 
> 
> 
> 
> So if I have name[nn].property, that essentially means I am creating an
> array of the form. But what I really need is an array of property,
> instead of the bean.
> 
> Question 2:
> 
> How should the property be declared in the the actionForm if it has to
> receive an array of information.
> 
> 
> thanks
> 
> 
> 
> 
> Rajat Pandit | [EMAIL PROTECTED]
> +91 612 3117606
> [ Developer and Part Time Human Being]
> 
> 
> -
> 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 Properties + Validator + JavaScript

2003-10-28 Thread Vara Prasad Reddy
The validations for indexed properties are not fired on the client side,
they are fired on the server side only.

Is there a way I can do that on the client side.

I am working on a PO screen with many line items.

Regards
Vara Prasad


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



Indexed Properties & Struts Validator

2003-11-03 Thread Frederic Dernbach
I would like to know how to use the Struts Validator with indexed
properties.

I cannot display error messages under the field (but the validator
obviously works and performs validation). 

Below is the relevant parts of my JSP ,valdiation.xml file and form :
Upon submission of the JSP's form, I can see the validator does not
validate the 'orderNumber' property if it is empty. But no error
messages is displayed.

Can an error message be displayed under the input field if the property
being validated is indexed ?

If I try to modify the validation.xml in order to include :
indexedListProperty="parameter" rather than
indexedListProperty="parameters" (which I would image is the good thing
to do in order to match the "parameter[i].orderNumber" property name),
then I get an exception when validation happens.
java.lang.NoSuchMethodException: Property 'parameter' has no getter
method
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1180)
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772)
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
org.apache.commons.validator.Validator.validateField(Validator.java:487)
org.apache.commons.validator.Validator.validate(Validator.java:582)
org.apache.struts.validator.ValidatorActionForm.validate(ValidatorActionForm.java:121)
com.rubis.web.system.action.SubmitStrategyAction.save(SubmitStrategyAction.java:71)

Can anybody let me know what's wrong with my code ?

Fred


 JSP 




.../... 





.../...
   



 validation.xml 




*** form setter and getter methods ***

public LinkedList getParameters() {
return parameters;
}

public void setParameters(LinkedList parameters) {
this.parameters = parameters;
}   

public ParamInterfaceElementBean getParameter(int index) {
while( index >= parameters.size() ){
parameters.add(new ParamInterfaceElementBean());
}
return (ParamInterfaceElementBean) parameters.get(index);
}

public void setParameter(int index, ParamInterfaceElementBean parameter)
{
while ( index >= parameters.size() ){
parameters.add(new ParamInterfaceElementBean());
}
parameters.set(index, parameter);
}



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



Validator and Indexed Properties

2003-11-13 Thread Robert Taylor
As of March 14, 2003 it appears that Struts/Commons validation does not
support indexed properties as such:

I have a collection of objects A where each A has some properties, call them
p1, p2, and p3.
I want to validate field p3 for each object A in the collection.

Is this currently possible with Struts1.1?

I've search the archives and found others with similar questions. Various
work arounds were presented, but I wanted to know if Struts provides
standard support for such a situation.

If so, I would appreciate some advice on how to construct my  or
a link to some documentation.

Here is a message in the archives which points to relavent attempts to
circumvent what was considered a bug.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg63332.html


robert



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



Conventions for indexed properties

2004-01-22 Thread Sunil Dmonte
Hi - could someone please point me to a definitive guide to get() and set()
conventions for indexed properties in Struts? I've seen and tried plenty of
variations; there doesn't seem to be one standard solution that works every
time.

E.g. for the property
List books = new ArrayList();   // assume will contain Strings

I've seen variations as shown below. What combination of the getters and
setters below does one use? If it varies according to how the property is
being used in the JSP (e.g. html:options, logic:iterate), how so? And does
it make a difference if you're using an array instead of a list?

(Note: I've omitted the required range-checks for clarity.)

GETTERS:

1.
public List getBooks() { 
  return books;
}

2. (Saw this one at http://jakarta.apache.org/struts/faqs/indexedprops.html,
makes no sense to me)
public List getBooks(int index) { 
  return books;
}

3.
public String getBooks(int index) { 
  return (String) books.get(index);
}

SETTERS:

1.
public void setBooks(List books) {
  this.books = books;
}

2.
public void setBooks (int index, String book) {
  books.set(index, book);
}

Thanks for your help,
Sunil

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



Indexed properties and form

2003-02-11 Thread Samir Shah

Hi,

I have a JSP page that outputs data using a Collection
using the following section


 
   

   
 
  

 <%=i %>
<% i++; %>
  

  
 


The above JSP is converted into the following HTML
code


 
 
   



I am having a problem writing the corresponding
ActionForm, 
the problem is how do I declare the variables to
capture the values entered by the user

I have attempted to write it and here is what I came
up with


public class GotoStep4Form extends ValidatorForm
implements Serializable {



private ArrayList records = null;


private BenefitLineItem [] lifeBenefits;
private String [] benClsTtl;

public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = super.validate(mapping,
request);

if(errors == null) errors = new ActionErrors();

if (!errors.empty() ) {
HttpSession session = request.getSession();

}

return errors;
}


public BenefitLineItem getLifeBenefit(int index) {
   while(index >=records.size() ){
this.records.add(new
BenefitLineItem());
}
  return (BenefitLineItem) records.get(index);
   }
   



/**
 * Gets the benClsTtl
 * @return Returns a String[]
 */
public String[] getBenClsTtl() {
return benClsTtl;
}
/**
 * Sets the benClsTtl
 * @param benClsTtl The benClsTtl to set
 */
public void setBenClsTtl(String[] benClsTtl) {
this.benClsTtl = benClsTtl;
}


/**
 * Sets the lifeBenefit
 * @param lifeBenefit The lifeBenefit to set
 */
public void setLifeBenefit(int index, BenefitLineItem
lifeBenefit) {
this.lifeBenefits[index] = lifeBenefit;
}

public BenefitLineItem[] getLifeBenefits() {
return lifeBenefits;
}

public void setLifeBenefits( BenefitLineItem[] v) {
lifeBenefits = v;
}



}

The above gives me an error :
WebGroup  X Servlet Error: BeanUtils.populate:
java.lang.reflect.InvocationTargetException:
java.lang.NullPointerException
at
com.fdl.quoteweb.actionforms.GotoStep4Form.getLifeBenefit(GotoStep4Form.java:53)
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:475)
at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:410)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:749)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:780)
at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:793)
at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978)
at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:779)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)


What am I doing Wrong?  How dow I define the variables
in the ActionForm to have Struts populate the data
in the form?

Any help will be appreciated.

Thanks,
Samir

__
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

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




html:text accepts indexed properties

2003-03-05 Thread Mohan Radhakrishnan
Hi,
   Has anybody ensured dates in the text box are not reset ? I want the
value entered by the user to be retained in the html:text box. My dates in
the form are of type String[]. And  I didn't find a way to make html:text
accept indexed properties.
Thanks,
Mohan

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



Re: Validator & Indexed Properties

2003-03-15 Thread Vic Cekvenich
It works fine for my clients with 2 diferent patches offered, on dev 
list a long time ago:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8798
and attached sollution on May of 2002, almost a year ago, you can search 
the dev list on the topic.

Then there is a 2nd better patch that I kind of stop giving out becuase 
there was to much private traffic:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg55192.html
(one commiter did ask for the 2nd one and I gave it out)

So, it's "known" bug with a "known" solution. :-(

.V

Jim Krygowski wrote:
Hey All-

I can't seem to get the validation.xml file configured correctly so that I
can validate indexed properties.   I've done a bunch of Mailing List/Google
searches and come up dry.  I've tried to configure it as suggested by D.
Winterfeldt and P. Ginnaram, but neither approach worked.  I ended up
getting the following useless javascript function rendered:
function DateValidations () {
}
Which as you notice, contains no validations.  I've hard-coded
(field="indexed[0].value") and the javascript rendered worked perfectly.  Of
course that's useless because I don't know how many result may come back.
Matt Raible seemed to be on the same route (note that his emails to the list
post-date Winterfeldt & Ginnaram) but his last email seems to indicate that
he's going to write his own custom javascripts to handle this.
My question is, does the validator handle indexed properties as of
struts-1.1b3 (aka RC1)??? If so, how is it done?  If not, does anyone have a
workaround (Matt if you're listening...)?
Here are a few links to the discussions regarding the validator and indexed
properties:
D. Winterfeldt Thu, 13 Jun 2002
Re: Indexed Property Validation on a String[]
http://www.mail-archive.com/[EMAIL PROTECTED]/msg33752.html
P. Ginnaram Tue, 20 Aug 2002
http://www.mail-archive.com/[EMAIL PROTECTED]/msg38703.html
M Raible
Validating Indexed Properties
17 Dec 2002
http://www.mail-archive.com/[EMAIL PROTECTED]/msg51913.html
Mon, 20 Jan 2003
http://www.mail-archive.com/[EMAIL PROTECTED]/msg54868.html
Tue, 21 Jan 2003
http://www.mail-archive.com/[EMAIL PROTECTED]/msg55133.html
Brandon Goodin Sat, 01 Feb 2003
[Validator] indexed property validation
http://www.mail-archive.com/[EMAIL PROTECTED]/msg56956.html


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


Validator: validating indexed properties

2002-12-17 Thread Matt Raible
I have been given the impression that the Validator can be used to 
validate indexed properties in a form.  I'm trying to figure out the 
validation.xml syntax to perform this validation.

If I have a GroupForm that contains an ArrayList of UserForms, how do I 
configure validation.xml?

For instance:

public GroupForm extends ValidatorForm {

	private ArrayList users;

	public ArrayList getUsers() {
		return users;
	}

	public void setUsers(ArrayList users) {
		this.users = users;
	}

	public UserForm getUser(int index) {
		return (UserForm) users.get(index);
	}

	public void setUser(int index, UserForm user) {
		this.users.set(index, user);
}

I've seen the indexedPropertyList attribute in the validation.xml's 
DTD, but I'm wondering how to use it.  Will something like this work?


   depends=”required” indexedListProperty="users">

field[0]
name
  
  
field-indexed[0]
true
  
  
field-test[0]
NOTNULL



Thanks for any advice,

Matt

Indexed Properties and Population

2003-01-16 Thread Raible, Matt
I have an ArrayList on a form... let's call the form Parent and the
ArrayList Children.

If I have:

private ArrayList children;

public void setChildren(int index, ChildForm childForm) {
this.children.set(index, childForm);
}

Then saving my form results in a NPE for BeanUtils.copyProperties.  If I
create a whole bunch of objects in the ArrayList in the constructor - I
avoid this problem:

public ParentForm () {
children = new ArrayList(100);
for (int i=0; i < 100; i++) {
children.add(new ChildForm());
}

But I'm guessing that this fits better into the reset(mapping, request)
method of my form.  My question is - how do I determine how many there are?
Is there something in the request this this information - or should I set a
hidden field with the number of children?

Thanks,

Matt


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




[Validator] validating indexed properties

2003-01-20 Thread Raible, Matt
I found the following example of validating an indexed property:

 
 
 
   mask
   ${zip}
 
 

Is it possible to do this without hardcoding the [1]?  I don't know how many
rows of beans will be in my page, but I do know the required fields in each
row.  Is this possible to render with the Validator - or do I have to resort
to writing my own javascript?

Thanks,

Matt


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Validating indexed properties

2003-01-21 Thread V. Cekvenich
There are 2 patches  (that I have tried submitting to BugZila a few 
times) that make multi row indexed validation work as is. My clients use 
the patched Struts that make the multi row validation work. I have no 
idea what others do (I can't be one of few with multi row master detail)

Send me a private e-mail and get both patches, either works, use at your 
own risk.

.V
[EMAIL PROTECTED]

Raible, Matt wrote:
I'm guessing that nothing has changed since the message below on Aug. 2001.
Since this is not possible, I'm willing to write out a bunch of Javascript
to do this validation.  My question is, how do I get the mask and such from
the validator.  The validator produces the following:

function mask () { 
 this.aa = new Array("signals[1].action", "The signal '1' has an invalid
action.  Please enter +, - or nothing at all.", new Function ("varName",
"this.mask=/^(\\+|\\-|\\s)$/;  return this[varName];"));

And I want to do this, except using a new function and I'll write signals[1]
- signals[x] as variables.

Thanks,

Matt

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg13943.html

* From: David Winterfeldt
* Subject: RE: Does the Validator package work with indexed properties?
* Date: Tue, 21 Aug 2001 15:28:27 -0700 

It can, but it is the same issue as the indexed
property.  You would have to define each field.  There
isn't currently anything where you can specify
'name[x]' and have it match any index (name[0],
name[1], etc.).  Which is what you would probably want
to do.

David

--- Shamdasani Nimmi-ANS004 <[EMAIL PROTECTED]>
wrote:

David,

What I was referring to are the tabular fields, i.e,
multiple rows of the same kind of data (a grid). Can
your package be used to validate those.

Thanks.

-Nimmi






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




indexed properties and multibox

2003-05-27 Thread Matthew Van Horn
Can someone please give me a hand with this. I really don't know what I  
am doing wrong. Sorry for the length - I just wanted to be clear.
I have a form that need to collect information about a person. This  
information falls into several groups such as:
Bourbon
[] Jim Beam
[] Makers Mark
[] Blantons

Scotch
[] Johnnie Walker
[] Macallan
[] Lagavulin
Beer
[] Budweiser
[] Heineken
[] Duvel
Users can select 0 or more from each category, so I would like to use  
multibox to create 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:

	
	
		
		
  		
   		
	  


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]


problem with indexed properties

2004-02-13 Thread Shyam A
Hello,

I'm trying to use indexed propeties in my form bean
(ActionForm) to handle an array of text fields
generated dynamically. Initially, I used a String[] to
hold the text field values, and had a problem when
validation errors occured in my validate() method,
i.e, the values of the text fields were not retained.

To work around that, I'm trying indexed properties,
but it has not helped my cause, only added to my
woes:(

With indexed properties, I don't seem to get the
values of the textfields in the form bean(I get a
NullPointerException on form submission). Also, the
values in the textfields are not retained on
validation errors.
When my JSP is displayed initially, I seem to get some
null/junk entries in the text fields.

I used the sample code from
http://marc.theaimsgroup.com/?l=struts-user&m=104815589928698&w=2
for my form bean.

So, in my ActionForm, I have

#
private List candList = new ArrayList(); //previoulsy
was String[]

public List getCandList() 
   {
  return candList;
   }

public void setCandList(List aCandList) 
   {
  candList = aCandList;
   }


public String getCandList(int index) 
   {
  while(index >= candList.size()){

candList.add(new String(""));

}   
  return (String) candList.get(index);
   }


 public void setCandList(int index,String aCand) 
   {
  candList.set(index,aCand);
   }

-

I do not set candList=null in the reset() method.

In my Action class (DispatchAction), I have two
methods - get() and submit() corresponding to "get"
and "submit" requests on my JSP. In the get() method,
I tried populating the candList in my form bean with
dummy values, corresponding to the number of text
fields(obtained from database).

In my JSP, I use



within a  tag for a collection (of
business entities).


-
I guess there may be something wrong with the
getters/setters in my ActionForm, as my form bean
doesn't seem to get the user entered values in the
text fields.
Am I missing something in the reset() method?

Could somebody tell me what I'm doing wrong.

I'm not sure if the candList in my form bean should be
populated with dummy values in the get() method of my
Action class.

I tried in vain to find some good examples of form
beans with indexed properties..most of the examples
are for DynaActionForm, and I'm really strutting in
the dark:(

Any help/pointers will be greatly appreciated.


Thanks,
Shyam



__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



RE: Indexed Properties - soluce :-)

2002-07-16 Thread Arnaud HERITIER

Ok I found myself a solution (it seems) :

I need to modify the JSP page to index manually the property and I don't
need to use the indexed="true" which indexes the BEAN and not the property :


" value="A"/>" value="B"/>



Arnaud

> -Message d'origine-
> De : Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> Envoyé : mardi 16 juillet 2002 15:50
> À : Struts Users Mailing List (E-mail)
> Objet : Indexed Properties
>
>
> Hi guys.
>
> I'm trying to use the Indexed properties of Struts 1.1.
>
> What I understood about indexedProperties is that it allows
> to have a set of
> properties (in a form bean) represented by an array of Strings.
>
> What I want to do is quite simple.
>
> I have a form with a dynamic list of radio buttons groups.
>
> in HTML it is something like this :
>
> 
>  name="myRadios1" value="B" checked="checked">
>  checked="checked"> type="radio" name="myRadios2" value="B">
> 
>  checked="checked"> type="radio" name="myRadiosN" value="B">
> 
>
> in Java with Struts I wrote a FormBean (class MyFormBean)
> with a property
> using an array of strings : String[] myRadios (with getter and setter)
>
> in the JSP :
>
> 
> 
>  property="myRadios" indexed="true" value="B"/>
> 
> 
>
> If I initialize the property myRadios of my formbean with the
> following
> Array : String[] myRadios = {"A","A","B","A"};
> the JSP generates the good numbers of radio items like this :
>
> 
>  name="myRadios1" value="B">
>  name="myRadios2" value="B">
>  name="myRadios3" value="B">
>  name="myRadios4" value="B">
> 
>
> but the problem is that this radios aren't initialized with
> the good checked
> properties.
>
> What I'm waiting for is somethink like :
>
> 
>  checked="checked"> type="radio" name="myRadios1" value="B">
>  checked="checked"> type="radio" name="myRadios2" value="B">
>  name="myRadios3" value="B" checked="checked">
>  checked="checked"> type="radio" name="myRadios4" value="B">
> 
>
> I don't understand what happens ??
>
> Can you help me please.
>
> Thx.
>
>   Arnaud HERITIER
>   EAI Consulting
>   Sopra Group
>   Tél. : +33 (0)1 53 33 44 74
>   email : [EMAIL PROTECTED]
>
>   Ce message est exclusivement destiné aux personnes dont le
> nom figure
> ci-dessus. Il peut contenir des informations confidentielles dont la
> divulgation est à ce titre rigoureusement interdite. Dans
> l'hypothèse où
> vous avez reçu ce message par erreur, merci de le renvoyer à l'adresse
> e-mail ci-dessus et de détruire toute copie.
>
>   This message may contain confidential and proprietary
> material for the
> sole use of the intended recipient. Any review or
> distribution by others is
> strictly prohibited. If you are not the intended recipient,
> please contact
> the sender and delete all copies.
>
>


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




Re: Indexed Properties - soluce :-)

2002-07-16 Thread Eddie Bush

May I make a suggestion?  You're causing the implicit creation of many 
strings ... and doing it in a loop (bad).  Try this:







This way, you don't have the implicit string creation (you get one every 
time you use the + to concatenate).  Object creation is slow :-( so 
don't do it if you don't have to.

Regards,

Eddie

Arnaud HERITIER wrote:

>Ok I found myself a solution (it seems) :
>
>I need to modify the JSP page to index manually the property and I don't
>need to use the indexed="true" which indexes the BEAN and not the property :
>
>property="myRadios">
>" value="A"/>property="<%=\"myRadios[\"+index+\"]\"%>" value="B"/>
>
>
>
>Arnaud
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Indexed Properties - soluce :-)

2002-07-17 Thread Arnaud HERITIER

All suggestions are welcome Eddie.

Your idea and your argumentations are good, but your proposed solution
doesn't work :-(

Explanations :

In a taglib property you can use either a string value or a RunTime
Expression (if allowed in the TLD).

If you use a string you have something like :  property="all I want to
write"

If you use a RT Expr you have something like : property="<%=java
expression%>"

The tag libraries interpreter verify if the content of the property begins
with <%= and ends with %> .
In this case it suppose that it is a RT Expr and values it.
In all other case it supposes that the content is a string.

With your suggestion, property="myRadios[<%= index %>]" the tag libraries
interpretor see that there's not <%= at the begining and %> at the end.
Then it passes the value "myRadios[<%= index %>]" as a string to the taglib.

When the taglib get the content of property, it will analize it and see that
it is a indexed property because of [..] but won't be able to interpret it
and will launch an exception like :

java.lang.IllegalArgumentException: Invalid indexed property
'myRadios[<%=index%>]'

However, it is important to say that your advice is totally good if you want
to use a dynamic value in standard html tag.

I you have another idea to clean my code, don't hesitate to propose it.


Arnaud.


> -Message d'origine-
> De : Eddie Bush [mailto:[EMAIL PROTECTED]]
> Envoye : mardi 16 juillet 2002 17:54
> A : Struts Users Mailing List
> Objet : Re: Indexed Properties - soluce :-)
>
>
> May I make a suggestion?  You're causing the implicit
> creation of many
> strings ... and doing it in a loop (bad).  Try this:
>
> 
>  property="myRadios">
>  property="myRadios[<%= index %>]" value="B"/>
> 
> 
>
> This way, you don't have the implicit string creation (you
> get one every
> time you use the + to concatenate).  Object creation is slow :-( so
> don't do it if you don't have to.
>
> Regards,
>
> Eddie
>
> Arnaud HERITIER wrote:
>
> >Ok I found myself a solution (it seems) :
> >
> >I need to modify the JSP page to index manually the property
> and I don't
> >need to use the indexed="true" which indexes the BEAN and
> not the property :
> >
> > >property="myRadios">
> >"
> value="A"/> >property="<%=\"myRadios[\"+index+\"]\"%>" value="B"/>
> >
> >
> >
> >Arnaud
> >
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>



RE: Indexed Properties - soluce :-)

2002-07-17 Thread mriem

Hi there,

Actually when you are looking at the stuff done in the JSTL
all three ways pretty much work, because it contains a
scripting language ;).

Are there any plans on integrating it within Struts? I like 
both libraries very much, and I recall a discussion was going
on a while ago about it?

If it is done this would make it is either:

  1. property = "all I want to write"
 
  2. property = "<%= java expression %>"

  3. property = "${myRadios[param.index]}"
  
  (here with 'index' as a request variable ;))

Manfred.
 
> -Original Message-
> From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, July 17, 2002 10:29 AM
> To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> Subject: RE: Indexed Properties - soluce :-)
> 
> 
> All suggestions are welcome Eddie.
> 
> Your idea and your argumentations are good, but your proposed 
> solution doesn't work :-(
> 
> Explanations :
> 
> In a taglib property you can use either a string value or a 
> RunTime Expression (if allowed in the TLD).
> 
> If you use a string you have something like :  property="all 
> I want to write"
> 
> If you use a RT Expr you have something like : 
> property="<%=java expression%>"
> 
> The tag libraries interpreter verify if the content of the 
> property begins with <%= and ends with %> . In this case it 
> suppose that it is a RT Expr and values it. In all other case 
> it supposes that the content is a string.
> 
> With your suggestion, property="myRadios[<%= index %>]" the 
> tag libraries interpretor see that there's not <%= at the 
> begining and %> at the end. Then it passes the value 
> "myRadios[<%= index %>]" as a string to the taglib.
> 
> When the taglib get the content of property, it will analize 
> it and see that it is a indexed property because of [..] but 
> won't be able to interpret it and will launch an exception like :
> 
> java.lang.IllegalArgumentException: Invalid indexed property 
> 'myRadios[<%=index%>]'
> 
> However, it is important to say that your advice is totally 
> good if you want to use a dynamic value in standard html tag.
> 
> I you have another idea to clean my code, don't hesitate to 
> propose it.
> 
> 
> Arnaud.
> 

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


RE: Indexed Properties - soluce :-)

2002-07-17 Thread Craig R. McClanahan



On Wed, 17 Jul 2002 [EMAIL PROTECTED] wrote:

> Date: Wed, 17 Jul 2002 15:30:38 +0200
> From: [EMAIL PROTECTED]
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED],
>  'Struts Users Mailing List' <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: Indexed Properties - soluce :-)
>
> Hi there,
>
> Actually when you are looking at the stuff done in the JSTL
> all three ways pretty much work, because it contains a
> scripting language ;).
>
> Are there any plans on integrating it within Struts? I like
> both libraries very much, and I recall a discussion was going
> on a while ago about it?
>
> If it is done this would make it is either:
>
>   1. property = "all I want to write"
>
>   2. property = "<%= java expression %>"
>
>   3. property = "${myRadios[param.index]}"
>

My current thinking is that we'll make some variant of #3 available in
Struts tags, in a release after 1.1.  But this will primarily be as a
transition tool -- subsequent releases of Struts will be designed such
that you should use JSTL tags directly, as opposed to the corresponding
Struts tags in the "bean" and "logic" libraries.  For the "html" tags,
we'll end up with JavaServer Faces tags when it's released.

>   (here with 'index' as a request variable ;))
>
> Manfred.

Craig McClanahan



>
> > -----Original Message-
> > From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 17, 2002 10:29 AM
> > To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> > Subject: RE: Indexed Properties - soluce :-)
> >
> >
> > All suggestions are welcome Eddie.
> >
> > Your idea and your argumentations are good, but your proposed
> > solution doesn't work :-(
> >
> > Explanations :
> >
> > In a taglib property you can use either a string value or a
> > RunTime Expression (if allowed in the TLD).
> >
> > If you use a string you have something like :  property="all
> > I want to write"
> >
> > If you use a RT Expr you have something like :
> > property="<%=java expression%>"
> >
> > The tag libraries interpreter verify if the content of the
> > property begins with <%= and ends with %> . In this case it
> > suppose that it is a RT Expr and values it. In all other case
> > it supposes that the content is a string.
> >
> > With your suggestion, property="myRadios[<%= index %>]" the
> > tag libraries interpretor see that there's not <%= at the
> > begining and %> at the end. Then it passes the value
> > "myRadios[<%= index %>]" as a string to the taglib.
> >
> > When the taglib get the content of property, it will analize
> > it and see that it is a indexed property because of [..] but
> > won't be able to interpret it and will launch an exception like :
> >
> > java.lang.IllegalArgumentException: Invalid indexed property
> > 'myRadios[<%=index%>]'
> >
> > However, it is important to say that your advice is totally
> > good if you want to use a dynamic value in standard html tag.
> >
> > I you have another idea to clean my code, don't hesitate to
> > propose it.
> >
> >
> > Arnaud.
> >
>


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




RE: Indexed Properties - soluce :-)

2002-07-17 Thread mriem

Hi Craig,

Cool to hear that you are considering it ;). Can I help out
in any way? 

Manfred Riem

> > If it is done this would make it is either:
> >
> >   1. property = "all I want to write"
> >
> >   2. property = "<%= java expression %>"
> >
> >   3. property = "${myRadios[param.index]}"
> >
> 
> My current thinking is that we'll make some variant of #3 
> available in Struts tags, in a release after 1.1.  But this 
> will primarily be as a transition tool -- subsequent releases 
> of Struts will be designed such that you should use JSTL tags 
> directly, as opposed to the corresponding Struts tags in the 
> "bean" and "logic" libraries.  For the "html" tags, we'll end 
> up with JavaServer Faces tags when it's released.
> 
> >   (here with 'index' as a request variable ;))
> >
> > Manfred.
> 
> Craig McClanahan


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Indexed Properties - soluce :-)

2002-07-17 Thread Craig R. McClanahan



On Wed, 17 Jul 2002 [EMAIL PROTECTED] wrote:

> Date: Wed, 17 Jul 2002 17:36:57 +0200
> From: [EMAIL PROTECTED]
> To: 'Craig R. McClanahan' <[EMAIL PROTECTED]>,
>  'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: RE: Indexed Properties - soluce :-)
>
> Hi Craig,
>
> Cool to hear that you are considering it ;). Can I help out
> in any way?
>

Sure.

Short term -- help us get the remaining bugs in 1.1 swatted so we can
release it and pay the appropriate amount of attention to this :-).

Longer term -- subscribe to the STRUTS-DEV mailing list, where the plans
for the future of Struts will be discussed and hammered out.  Example
implementations of this sort of thing (either posted somewhere else or
perhaps in the "contrib" directory) would motivate more discussion about
exactly which tags and attributes this makes sense for.

> Manfred Riem
>

Craig


> > > If it is done this would make it is either:
> > >
> > >   1. property = "all I want to write"
> > >
> > >   2. property = "<%= java expression %>"
> > >
> > >   3. property = "${myRadios[param.index]}"
> > >
> >
> > My current thinking is that we'll make some variant of #3
> > available in Struts tags, in a release after 1.1.  But this
> > will primarily be as a transition tool -- subsequent releases
> > of Struts will be designed such that you should use JSTL tags
> > directly, as opposed to the corresponding Struts tags in the
> > "bean" and "logic" libraries.  For the "html" tags, we'll end
> > up with JavaServer Faces tags when it's released.
> >
> > >   (here with 'index' as a request variable ;))
> > >
> > > Manfred.
> >
> > Craig McClanahan
>
>


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




RE: Indexed Properties - soluce :-)

2002-07-17 Thread dhay



Why don't you use the Indexed property in the nightly builds?

David





"Arnaud HERITIER" <[EMAIL PROTECTED]> on 07/17/2002
04:29:00 AM

Please respond to "Struts Users Mailing List"
  <[EMAIL PROTECTED]>; Please respond to
  [EMAIL PROTECTED]

To:   "'Struts Users Mailing List'"
  <[EMAIL PROTECTED]>,
  [EMAIL PROTECTED]
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  RE: Indexed Properties - soluce :-)



All suggestions are welcome Eddie.

Your idea and your argumentations are good, but your proposed solution
doesn't work :-(

Explanations :

In a taglib property you can use either a string value or a RunTime
Expression (if allowed in the TLD).

If you use a string you have something like :  property="all I want to
write"

If you use a RT Expr you have something like : property="<%=java
expression%>"

The tag libraries interpreter verify if the content of the property begins
with <%= and ends with %> .
In this case it suppose that it is a RT Expr and values it.
In all other case it supposes that the content is a string.

With your suggestion, property="myRadios[<%= index %>]" the tag libraries
interpretor see that there's not <%= at the begining and %> at the end.
Then it passes the value "myRadios[<%= index %>]" as a string to the taglib.

When the taglib get the content of property, it will analize it and see that
it is a indexed property because of [..] but won't be able to interpret it
and will launch an exception like :

java.lang.IllegalArgumentException: Invalid indexed property
'myRadios[<%=index%>]'

However, it is important to say that your advice is totally good if you want
to use a dynamic value in standard html tag.

I you have another idea to clean my code, don't hesitate to propose it.


Arnaud.


> -Message d'origine-
> De : Eddie Bush [mailto:[EMAIL PROTECTED]]
> Envoye : mardi 16 juillet 2002 17:54
> A : Struts Users Mailing List
> Objet : Re: Indexed Properties - soluce :-)
>
>
> May I make a suggestion?  You're causing the implicit
> creation of many
> strings ... and doing it in a loop (bad).  Try this:
>
> 
>  property="myRadios">
>  property="myRadios[<%= index %>]" value="B"/>
> 
> 
>
> This way, you don't have the implicit string creation (you
> get one every
> time you use the + to concatenate).  Object creation is slow :-( so
> don't do it if you don't have to.
>
> Regards,
>
> Eddie
>
> Arnaud HERITIER wrote:
>
> >Ok I found myself a solution (it seems) :
> >
> >I need to modify the JSP page to index manually the property
> and I don't
> >need to use the indexed="true" which indexes the BEAN and
> not the property :
> >
> > >property="myRadios">
> >"
> value="A"/> >property="<%=\"myRadios[\"+index+\"]\"%>" value="B"/>
> >
> >
> >
> >Arnaud
> >
>
>
>
> --
> 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: Indexed Properties - soluce :-)

2002-07-18 Thread Arnaud HERITIER

Craig.

Can you give us some news about the JSR 127 ??

Do you have planned a draft for the JavaServer Faces ??

Thx

Arnaud

> -Message d'origine-
> De : Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> Envoye : mercredi 17 juillet 2002 17:11
> A : Struts Users Mailing List
> Cc : [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Objet : RE: Indexed Properties - soluce :-)
>
>
>
>
> On Wed, 17 Jul 2002 [EMAIL PROTECTED] wrote:
>
> > Date: Wed, 17 Jul 2002 15:30:38 +0200
> > From: [EMAIL PROTECTED]
> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED],
> >  'Struts Users Mailing List' <[EMAIL PROTECTED]>,
> >  [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: RE: Indexed Properties - soluce :-)
> >
> > Hi there,
> >
> > Actually when you are looking at the stuff done in the JSTL
> > all three ways pretty much work, because it contains a
> > scripting language ;).
> >
> > Are there any plans on integrating it within Struts? I like
> > both libraries very much, and I recall a discussion was going
> > on a while ago about it?
> >
> > If it is done this would make it is either:
> >
> >   1. property = "all I want to write"
> >
> >   2. property = "<%= java expression %>"
> >
> >   3. property = "${myRadios[param.index]}"
> >
>
> My current thinking is that we'll make some variant of #3 available in
> Struts tags, in a release after 1.1.  But this will primarily be as a
> transition tool -- subsequent releases of Struts will be designed such
> that you should use JSTL tags directly, as opposed to the
> corresponding
> Struts tags in the "bean" and "logic" libraries.  For the "html" tags,
> we'll end up with JavaServer Faces tags when it's released.
>
> >   (here with 'index' as a request variable ;))
> >
> > Manfred.
>
> Craig McClanahan
>
>
>
> >
> > > -Original Message-
> > > From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, July 17, 2002 10:29 AM
> > > To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> > > Subject: RE: Indexed Properties - soluce :-)
> > >
> > >
> > > All suggestions are welcome Eddie.
> > >
> > > Your idea and your argumentations are good, but your proposed
> > > solution doesn't work :-(
> > >
> > > Explanations :
> > >
> > > In a taglib property you can use either a string value or a
> > > RunTime Expression (if allowed in the TLD).
> > >
> > > If you use a string you have something like :  property="all
> > > I want to write"
> > >
> > > If you use a RT Expr you have something like :
> > > property="<%=java expression%>"
> > >
> > > The tag libraries interpreter verify if the content of the
> > > property begins with <%= and ends with %> . In this case it
> > > suppose that it is a RT Expr and values it. In all other case
> > > it supposes that the content is a string.
> > >
> > > With your suggestion, property="myRadios[<%= index %>]" the
> > > tag libraries interpretor see that there's not <%= at the
> > > begining and %> at the end. Then it passes the value
> > > "myRadios[<%= index %>]" as a string to the taglib.
> > >
> > > When the taglib get the content of property, it will analize
> > > it and see that it is a indexed property because of [..] but
> > > won't be able to interpret it and will launch an exception like :
> > >
> > > java.lang.IllegalArgumentException: Invalid indexed property
> > > 'myRadios[<%=index%>]'
> > >
> > > However, it is important to say that your advice is totally
> > > good if you want to use a dynamic value in standard html tag.
> > >
> > > I you have another idea to clean my code, don't hesitate to
> > > propose it.
> > >
> > >
> > > Arnaud.
> > >
> >
>
>
> --
> 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: Indexed Properties - soluce :-)

2002-07-18 Thread Craig R. McClanahan



On Thu, 18 Jul 2002, Arnaud HERITIER wrote:

> Date: Thu, 18 Jul 2002 11:09:24 +0200
> From: Arnaud HERITIER <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED]
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: Indexed Properties - soluce :-)
>
> Craig.
>
> Can you give us some news about the JSR 127 ??
>
> Do you have planned a draft for the JavaServer Faces ??
>

It is currently in "Community Review" in the JCP process, scheduled to end
on August 12.  Assuming positive votes by the JCP executive committee and
the JSR 127 expert group, the next phase after that is public review.

> Thx
>
> Arnaud
>

Craig


> > -Message d'origine-
> > De : Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
> > Envoye : mercredi 17 juillet 2002 17:11
> > A : Struts Users Mailing List
> > Cc : [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Objet : RE: Indexed Properties - soluce :-)
> >
> >
> >
> >
> > On Wed, 17 Jul 2002 [EMAIL PROTECTED] wrote:
> >
> > > Date: Wed, 17 Jul 2002 15:30:38 +0200
> > > From: [EMAIL PROTECTED]
> > > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > > To: [EMAIL PROTECTED],
> > >  'Struts Users Mailing List' <[EMAIL PROTECTED]>,
> > >  [EMAIL PROTECTED]
> > > Cc: [EMAIL PROTECTED]
> > > Subject: RE: Indexed Properties - soluce :-)
> > >
> > > Hi there,
> > >
> > > Actually when you are looking at the stuff done in the JSTL
> > > all three ways pretty much work, because it contains a
> > > scripting language ;).
> > >
> > > Are there any plans on integrating it within Struts? I like
> > > both libraries very much, and I recall a discussion was going
> > > on a while ago about it?
> > >
> > > If it is done this would make it is either:
> > >
> > >   1. property = "all I want to write"
> > >
> > >   2. property = "<%= java expression %>"
> > >
> > >   3. property = "${myRadios[param.index]}"
> > >
> >
> > My current thinking is that we'll make some variant of #3 available in
> > Struts tags, in a release after 1.1.  But this will primarily be as a
> > transition tool -- subsequent releases of Struts will be designed such
> > that you should use JSTL tags directly, as opposed to the
> > corresponding
> > Struts tags in the "bean" and "logic" libraries.  For the "html" tags,
> > we'll end up with JavaServer Faces tags when it's released.
> >
> > >   (here with 'index' as a request variable ;))
> > >
> > > Manfred.
> >
> > Craig McClanahan
> >
> >
> >
> > >
> > > > -Original Message-
> > > > From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, July 17, 2002 10:29 AM
> > > > To: 'Struts Users Mailing List'; [EMAIL PROTECTED]
> > > > Subject: RE: Indexed Properties - soluce :-)
> > > >
> > > >
> > > > All suggestions are welcome Eddie.
> > > >
> > > > Your idea and your argumentations are good, but your proposed
> > > > solution doesn't work :-(
> > > >
> > > > Explanations :
> > > >
> > > > In a taglib property you can use either a string value or a
> > > > RunTime Expression (if allowed in the TLD).
> > > >
> > > > If you use a string you have something like :  property="all
> > > > I want to write"
> > > >
> > > > If you use a RT Expr you have something like :
> > > > property="<%=java expression%>"
> > > >
> > > > The tag libraries interpreter verify if the content of the
> > > > property begins with <%= and ends with %> . In this case it
> > > > suppose that it is a RT Expr and values it. In all other case
> > > > it supposes that the content is a string.
> > > >
> > > > With your suggestion, property="myRadios[<%= index %>]" the
> > > > tag libraries interpretor see that there's not <%= at the
> > > > begining and %> at the end. Then it passes the value
> > > > "myRadios[<%= index %>]" as a string to the taglib.
> > > >
> > > > When the taglib get the content of property, it will analize
> > > > it and see that it is a indexed property because of [..] but
> > > > won't be able to interpret it and will launch an exception like :
> > > >
> > > > java.lang.IllegalArgumentException: Invalid indexed property
> > > > 'myRadios[<%=index%>]'
> > > >
> > > > However, it is important to say that your advice is totally
> > > > good if you want to use a dynamic value in standard html tag.
> > > >
> > > > I you have another idea to clean my code, don't hesitate to
> > > > propose it.
> > > >
> > > >
> > > > Arnaud.
> > > >
> > >
> >
> >
> > --
> > 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]>




Setting indexed properties - ArrayIndexOutOfBounds

2002-07-23 Thread Colin Wilson-Salt

Hi everyone. I've looked through the archives for this and the commons list,
without finding an answer to my problems with receiving indexed properties
from a form.

I've tried with both 1.1 beta and a nightly build from a couple of nights
ago. I'm not sure if my problem is with Struts, Commons / BeanUtils, or my
understanding of how indexed properties on a bean work.

I have a form which, amongst other things, has a tabular set of data:

...



Paint colour


  
  ...

In my form bean I have represented this with an indexed property.

...
public Row [] getRows() {
if (rows == null)
setRows(new Row [0]);

return rows;
}

public void setRows(Row [] rows) {
this.rows = rows;
}
...

Where Row is an inner (nested? never sure of the terminology - defined as
public static inside the form bean, anyway).

My problem is when Struts comes to populate my form bean with values from
the form. Instead of creating a new Row [] and calling setRows, it calls
getRows and then attempts to set values within the array. Trouble is, the
array isn't big enough, leading to an ArrayIndexOutOfBoundsException. And
there's no way I can tell how big to make the array, as the size of the form
varies.

So, I tried using a List instead of an array. But with the same result -
Struts would grab the list from public List getRows(), and then attempt to
set values at indexes within the list.

So, in desperation, I went back to my array version and added a getter and
setter that would take an index, but would 'resize' the array when the index
would be out of bounds:

...
public Row getRows(int i) {
if (i >= getRows().length)
increaseRows(i + 1);

return getRows()[i];
}

public void setRows(int i, Row row) {
if (i >= getRows().length)
increaseRows(i + 1);

getRows()[i] = row;
}
...

Now, that works. But I'm not very satisfied. I would have thought that, in
my original code, the only proper way to change values of the property would
be to create a new array and pass it to public void setRows(Row [] rows).
One argument for this is (thinking only of JavaBeans, not Struts) if the
property was bound, and the array was changed behind the objects back, it
wouldn't know to fire a PropertyChangeEvent.

So, is this a bug in Struts / Commons-BeanUtils? Or a flaw in my
understanding of JavaBeans? Or just a limitation I have to live with? Is the
workaround above 'legal' in terms of the JavaBeans spec? Is there a nicer
way to achieve what I'm trying to do?

Thanks in advance...

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




indexed properties problems ArrayIndexOutOfBoundsException

2001-07-31 Thread Nathan Coast

Hi,

I've followed various threads (Long Story Short etc) about Dave Hays index
tags enhancement and after much hair tearing!

The suggested code for the form bean is:

   private ArrayList parameterList = new ArrayList();

   public ArrayList getParameterList()
   {
  return(this.parameterList);
   }

   public void setParameterList(ArrayList parameterList)
   {
  this.parameterList = parameterList;
   }

   public Parameter getParameter(int index)
   {
System.out.println(index);
if (idx > parameterList.size()-1)
{
parameterList.add(index,new Parameter ());
}
return (Parameter) parameterList.get(index);   
}

The problem I'm getting is that struts is calling the getParameter(index)
method out of sequence e.g.

index=5
index=4
index=17
index=17
index=3
index=7
index=16
index=15
index=2
index=14
index=10
index=1
index=0
etc..

and so the calls to "add" and "get" on the ArrayList result in
ArrayIndexOutOfBoundsException rather than building up the values.

This problem would go away if I used session scope form beans but I'd rather
not do that.

Has anyone else seen this problem / found a neat solution?

Cheers Nathan


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**



RE: Validating indexed properties?

2002-05-01 Thread Parmar, Dipakkumar

Hi
I'm having the same problem. Please let me know if you find a solution.

Thanks
Deepak

-Original Message-
From: Struts Newsgroup [mailto:@[EMAIL PROTECTED]]
Sent: Tuesday, April 30, 2002 8:40 PM
To: [EMAIL PROTECTED]
Subject: Validating indexed properties?


Subject: Validating indexed properties?
From: Jose Quinteiro <[EMAIL PROTECTED]>
 ===
Say I have a JSP like this:


...


...


"someBean" has a method getRows() that returns a Collection. This
Collection has a method getRow(int) which returns an object with methods
getSomeProperty(), and getSomeOtherProperty().

In validate.xml I have:

...


The preceding does not work. However, this does work (i.e., it validates
the first someProperty):

...

What am I doing wrong?


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