Re: Indexed properties in forms

2009-02-10 Thread Dave Newton
You just need a collection/map getter/setter in the action, you don't 
need an indexed setter.


http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-CollectionandMapSupport

Dave

Ignacio de Córdoba wrote:

Hi there,
I am trying to migrate a form population module from struts1 to struts2 and
I am not sure if struts2 supports indexed/mapped value properties.

After reading OGNL docs I see that indexed properties are supported both
with ints and objects. I guess they refer just to "red" de properties, not
to set them in the action... so I am trying:

 Where id is an
integer.

My action has the method:
public void setFieldEntry(String fieldId, String value){}
(I've tried fieldID with int, Integer and String)
(Also I've tried String value and String[] value just in case it expects an
array of strings)

When I submit the form I get:

2009-02-11 02:14:49,195 WARN  [com.opensymphony.xwork2.ognl.OgnlValueStack]
Could not find property [struts.valueStack]
2009-02-11 02:14:49,198 INFO  [STDOUT] ognl.OgnlException: target is null
for setProperty(null, "1", [Ljava.lang.String;@410ef400)
2009-02-11 02:14:49,198 INFO  [STDOUT]  at
ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1651)
2009-02-11 02:14:49,198 INFO  [STDOUT]  at
ognl.ASTProperty.setValueBody(ASTProperty.java:101)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at
ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at
ognl.SimpleNode.setValue(SimpleNode.java:246)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at
ognl.ASTChain.setValueBody(ASTChain.java:172)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at
ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at
ognl.SimpleNode.setValue(SimpleNode.java:246)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at ognl.Ognl.setValue(Ognl.java:476)
2009-02-11 02:14:49,199 INFO  [STDOUT]  at
com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)

Thanks for any help




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



RE: Indexed Properties with nested Tags

2007-01-29 Thread Raghu
Hi Nagesh,

Actionform design will not change when using nested tags or logic tags.

When using nested tags PROPERLY then data will be be set automatically by
struts framework.
If you read line by line below and undertstand the code from struts
userguide/API then then you an easily catch the logic behind.

Feel free to write for any doubt..

Raghuveer


-Original Message-
From: nagesh.kumar [mailto:[EMAIL PROTECTED]
Sent: Monday, January 29, 2007 2:57 PM
To: [EMAIL PROTECTED]
Subject: RE: Indexed Properties with nested Tags


Hi raghu,

Iam also using the same issue ..



Ho u r cacthing the data in the Action from the form after submitting

Please forward that peace of code to me
Thanks in Advance

Nagesh


-Original Message-
From: Adam K [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 22, 2006 10:10 PM
To: [EMAIL PROTECTED]
Cc: Struts Users Mailing List
Subject: Re: Indexed Properties with nested Tags

Thanks for the lengthy example, but there is one part that I am completly
lost on.  I thought that the following occurred:
Click link to open page, formbean is reset aciton poppulates formbean jsp
retrieves values from the formbean.  User sees the screen prepopulated.
User modifies the information and clicks on submit.  The bean is again reset
the action is called to put information in the formbean (this is the part I
have no data) the jsp then pulls the data from the formbean.

What is the purpose of the System.out.println that you have at the end of
your action ?

thanks again,
Adam

On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
>
>  Hi Adam,
>
> Use the sample code as requested by you.
> You can ask me any help with nested Tags and from advanced struts
>
>
>
>
> *JSP*
>
>
> 
>  id="Result" type="com.test.javabeans.TestObject">
>   
> 
> 
>   
> 
> 
>
> *ActionForm*
> **
> public class ProdSelectionForm extends ActionForm { Collection
> arlResults=null; //can be arrayalist
>
> /**
>   * @return Returns the arlResults.
>   */
>  public Collection getResults() {
>   return arlResults;
>  }
>  /**
>   * @param arlResultsThe arlResultsto set.
>   */
>  public void setResults(Collection arlResults) {
>   this.arlResults= arlResults;
>  }
>
>  /**
>  *
>  * toString representation of object
>  * @return  An instance of StringBuffer with Struts Action Form
> properties
>  *
>  */
>   public String toString() {
>
>StringBuffer sbTemp = new StringBuffer();
>sbTemp.append("{");
>
>sbTemp.append("arlResults=" );
>sbTemp.append(arlResults);
>sbTemp.append("}");
>return sbTemp.toString();
>
>   }//end of toString
> }//end Actionform
>
> *TestObject  Java Bean*
>
> import java.io.Serializable;
>
> public class TestObject implements Serializable
>
> String description =null;
> int numProducts =0;
> /**
>  * @return Returns the description.
>  */
> public String getDescription() {
>  return description;
> }
> /**
>  * @param description The description to set.
>  */
> public void setDescription(String description) {  this.description =
> description; }
> /**
>  * @return Returns the numProducts.
>  */
> public int getNumProducts() {
>  return numProducts;
> }
> /**
>  * @param numProducts The numProducts to set.
>  */
> public void setNumProducts(int numProducts) {  this.numProducts =
> numProducts; }
>
> }//end object
> **
>
> *Action Class (loading the page)*
> **
> **
> ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;
> com.test.javabeans.TestObject obj1=new com.test.javabeans.TestObject
> (); obj1.setDescription("desc1"); obj1.setNumProducts (1);
>
>  com.test.javabeans.TestObject obj2=new com.test.javabeans.TestObject
> (); obj1.setDescription("desc2"); obj1.setNumProducts (2);
>
> ArrayList arlResults=new ArrayList (); arlResults.add(obj1);
> arlResults.add(obj2);
>
> prodSelectionForm.setResults(arlResults);
>
> *Action Class (Submitting the page)*
>
> When you submit the page just print the actionform you wouyld see the
> updated results of description ,numproducts in action
>
> ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;
>
> System.out.println("prodSelectionForm="+prodSelectionForm);
>
>
>
> Regards
> Raghu
>
> -Original Message-
> *From:* Adam K [mailto:[EMAIL PROTECTED]
> *Sent:* Wednesday, November 22, 2006 3:06 AM
> *To:* [EMAIL PROTECTED]
> *Cc:* Struts Users Mailing List
> *Subject:* Re: Indexed Properties
>
> If you might be able to provide a sample I would be very greatful.
> As it stands I

Re: Indexed Properties

2006-11-24 Thread WongTseng

Just think If the struts dosen't set these indexed properties from the lower
bound to the upper bound in a ascending order,  an  outofbound exception
will occur.


--
Wong Tseng
王曾


Re: Indexed Properties

2006-11-24 Thread WongTseng

I think it's the getResultsPage method that causes your problem. If the
results is none, and the parameter index equels any value that is large than
0, an OutOfBound Exception will occur.

2006/11/18, Adam K <[EMAIL PROTECTED]>:



public Product getResultsPage(int index)
{
if(this.results == null)
{
this.results = new ArrayList();
}

while(index >= this.results.size())
{
this.results.add(new Product());
}
return (Product) results.get(index);
}




--
Wong Tseng
王曾


Re: Indexed Properties

2006-11-23 Thread Adam K

Just thought that I would say that the following will be incredibly helpful
to anyone working on indexed properties in the future:
(It has a complete working example)

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=58&t=009880

thanks to everyone for all of the help.



On 11/23/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:


On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:
>
> If you might be able to provide a sample I would be very greatful.
> As it stands I have come up with the following :
> changing the JSP to :
>
> 
>  id="Result">
>   

 indexed="true" /> 
>   
> 
> 


Hmm.. As i said try something like this


  

 
  



In case you dont encounter any error while loading the page. please post
the
HTML generated. That would give a good idea of what is going wrong.


Result seemed more natural as it is a single element of the results.
> All I want to be able to do is pull 3 things out of an object, display
> them
> in a scope of request, and allow the user to update the list and submit
> the
> form and have the changes be picked up - who would have thought that
would
> be so incredibly complex ?
> *Note*  The part that leads me to believe it's a misunderstanding of the
> tags involved is that I can get a single textfield to work perfectly,
with
> all the requirements (other than it being an object with multiple
> properties).
>
>
> On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
> >
> > hi Adam,
> >
> > I understand description,numProducts are properties in User defined
> > Object/java bean in results(getResults(),setResults(..)) Collection in
> > your
> > actionForm.
> >
> > For this kind of requirments there will not be any change in
actionform
> > even
> > though ,complixety increases in nesting..
> >
> > Solution is to use Nested Tags.
> >
> > Nested tags are used for nesting a object inside the other.
> >
> > In your requirment "results" is a nested property in your actionform.
> > "results" collection  has a collection of objects.
> >
> > I have used Nested tags for most complex requirments and succeeded.
> >
> > Nested Tags is the real power of Struts...
> >
> >
> > Regards
> > Raghu
> >
> >
> >
> >
> >
> > -Original Message-
> > From: Adam K [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, November 18, 2006 2:55 AM
> > To: Struts Users Mailing List
> > Subject: Re: Indexed Properties
> >
> >
> > Thanks for the suggestion I'll keep trying things and see what I can
get
> > from it.
> >
> >
> > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > Lots of people have done it.  Search the archives [1]. Search for
> > > "indexed" and "lazyList".   I've done it with both ActionForm and
> > > DynaActionForm.
> > >
> > > Hubert
> > >
> > > [1] http://struts.apache.org/mail.html
> > >
> > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > I think I have found the problem - or at least a potential
> > cause.  Would
> > > it
> > > > be correct in stating that this will not work using ActionForm
(what
> I
> > > was
> > > > using)  and that I must instead use DynaActionForm ?
> > > >
> > > > Thanks for the time thus far.
> > > >
> > > >
> > > > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > Adam,
> > > > >
> > > > > Try adding a getResultsPage() that doesn't take params and
always
> > > > > returns a valid collection.  (Throw in the setResultsPage() that
> > > > > accepts a collection as well.)
> > > > >
> > > > > Hubert
> > > > >
> > > > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > > > This has been driving me nuts for the past little bit.
> > > > > > I have a page that is populated using indexed properties.  The
> > > > > prepopulation
> > > > > > works  fine, and I get the results as I would expect them, but
> > > trying to
> > > > > > submit the form I get an index out of bounds exception.  I
know
> > that
> > > it
> > > > > is
> > > > > > being caused because the page doesn't have the arrayLi

Re: Indexed Properties

2006-11-23 Thread Puneet Lakhina

On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:


If you might be able to provide a sample I would be very greatful.
As it stands I have come up with the following :
changing the JSP to :



  


   
indexed="true" /> 
  





Hmm.. As i said try something like this

   
 


 
   


In case you dont encounter any error while loading the page. please post the
HTML generated. That would give a good idea of what is going wrong.


Result seemed more natural as it is a single element of the results.

All I want to be able to do is pull 3 things out of an object, display
them
in a scope of request, and allow the user to update the list and submit
the
form and have the changes be picked up - who would have thought that would
be so incredibly complex ?
*Note*  The part that leads me to believe it's a misunderstanding of the
tags involved is that I can get a single textfield to work perfectly, with
all the requirements (other than it being an object with multiple
properties).


On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
>
> hi Adam,
>
> I understand description,numProducts are properties in User defined
> Object/java bean in results(getResults(),setResults(..)) Collection in
> your
> actionForm.
>
> For this kind of requirments there will not be any change in actionform
> even
> though ,complixety increases in nesting..
>
> Solution is to use Nested Tags.
>
> Nested tags are used for nesting a object inside the other.
>
> In your requirment "results" is a nested property in your actionform.
> "results" collection  has a collection of objects.
>
> I have used Nested tags for most complex requirments and succeeded.
>
> Nested Tags is the real power of Struts...
>
>
> Regards
> Raghu
>
>
>
>
>
> -Original Message-
> From: Adam K [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 18, 2006 2:55 AM
> To: Struts Users Mailing List
> Subject: Re: Indexed Properties
>
>
> Thanks for the suggestion I'll keep trying things and see what I can get
> from it.
>
>
> On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> >
> > Lots of people have done it.  Search the archives [1]. Search for
> > "indexed" and "lazyList".   I've done it with both ActionForm and
> > DynaActionForm.
> >
> > Hubert
> >
> > [1] http://struts.apache.org/mail.html
> >
> > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > I think I have found the problem - or at least a potential
> cause.  Would
> > it
> > > be correct in stating that this will not work using ActionForm (what
I
> > was
> > > using)  and that I must instead use DynaActionForm ?
> > >
> > > Thanks for the time thus far.
> > >
> > >
> > > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Adam,
> > > >
> > > > Try adding a getResultsPage() that doesn't take params and always
> > > > returns a valid collection.  (Throw in the setResultsPage() that
> > > > accepts a collection as well.)
> > > >
> > > > Hubert
> > > >
> > > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > > This has been driving me nuts for the past little bit.
> > > > > I have a page that is populated using indexed properties.  The
> > > > prepopulation
> > > > > works  fine, and I get the results as I would expect them, but
> > trying to
> > > > > submit the form I get an index out of bounds exception.  I know
> that
> > it
> > > > is
> > > > > being caused because the page doesn't have the arrayList to use
in
> > the
> > > > > indexed properties.   I guess my question boils down to using
> > indexed
> > > > > properties properly.  I will start by putting in an explanation
of
> > what
> > > > I
> > > > > have and what I am trying to do:
> > > > >
> > > > > The following is what I am working with :
> > > > > JSP:
> > > > >
> > > > > 
> > > > >  > > > > id="ResultsPage">
> > > > > 
> > > > >  > > > property="description"
> > > > > />
> > > > >  > > > property="numProducts"
> > > > > indexed="true" /> 
> > > > > 
> > >

RE: Indexed Properties with nested Tags

2006-11-22 Thread Raghu

In JSP make sure you add taglib directive

<%@ taglib uri="/tags/struts-nested" prefix="nested" %>

or

<%@ taglib uri="/WEB-INF/struts-nested" prefix="nested" %>

  -Original Message-
  From: Raghu [mailto:[EMAIL PROTECTED]
  Sent: Thursday, November 23, 2006 9:47 AM
  To: 'Adam K'
  Cc: 'Struts Users Mailing List'
  Subject: RE: Indexed Properties with nested Tags


  I am 100% sure.
  I have extensively used these futures and successful.

  Using Nested Tags will decrease the Lines of Code,Easy Maintenance..

  Nested tags will take care of setting the latest values to form bean
.There will not be any change in ActionForm/Action class.

  Framework will take care of setting the data to actionform for nested
properties from nested tags.

  Form bean may have getters and setter of scalar types(string,int...) or
nested types(user defined object,collection...).

  If you have done every thing as below,Your latest values from jsp will be
set to form bean when JSP page is Submitted.



  Clarification 1

  Add below method in TestObject  Java Bean also.This will help you
understand the Object Content/Data during population and submit.

  public String toString() {

 StringBuffer sbTemp = new StringBuffer();
 sbTemp.append("{");

 sbTemp.append("description=" );
 sbTemp.append(description);
  sbTemp.append("numProducts =" );
 sbTemp.append(numProducts );


 sbTemp.append("}");
 return sbTemp.toString();

}//end of toString

  Clarification 2

  System .out.println is added in order to make you understand that when JSP
is submitted you will have latest data in arlResults collection in
actionform.


  Regards,
  Raghu



-Original Message-
From: Adam K [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 22, 2006 10:16 PM
To: [EMAIL PROTECTED]
Cc: Struts Users Mailing List
Subject: Re: Indexed Properties with nested Tags


I should also like to say that the one part that seems to be giving me
the most problem is the setting of the variables in action when it is
submitted.
The other thing I am curious about is if what I am doing is incorrect.
I am using one action for both the submit as well as the prepopulate based
on a url parameter.

thanks once again.
Adam


On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:
  Thanks for the lengthy example, but there is one part that I am
completly lost on.  I thought that the following occurred:
  Click link to open page, formbean is reset aciton poppulates formbean
jsp retrieves values from the formbean.  User sees the screen prepopulated.
  User modifies the information and clicks on submit.  The bean is again
reset the action is called to put information in the formbean (this is the
part I have no data) the jsp then pulls the data from the formbean.

  What is the purpose of the System.out.println that you have at the end
of your action ?

  thanks again,
  Adam



  On 11/21/06, Raghuveer < [EMAIL PROTECTED]> wrote:
Hi Adam,

Use the sample code as requested by you.
You can ask me any help with nested Tags and from advanced struts




JSP




  
 
  



ActionForm

public class ProdSelectionForm extends ActionForm
{
Collection arlResults=null; //can be arrayalist

/**
  * @return Returns the arlResults.
  */
 public Collection getResults() {
  return arlResults;
 }
 /**
  * @param arlResultsThe arlResultsto set.
  */
 public void setResults(Collection arlResults) {
  this.arlResults= arlResults;
 }

 /**
 *
 * toString representation of object
 * @return  An instance of StringBuffer with Struts Action
Form properties
 *
 */
  public String toString() {

   StringBuffer sbTemp = new StringBuffer();
   sbTemp.append("{");

   sbTemp.append("arlResults=" );
   sbTemp.append(arlResults);
   sbTemp.append("}");
   return sbTemp.toString();

  }//end of toString
}//end Actionform

TestObject  Java Bean

import java.io.Serializable;

public class TestObject implements Serializable

String description =null;
int numProducts =0;
/**
 * @return Returns the description.
 */
public String getDescription() {
 return description;
}
/**
 * @param description The description to set.
 */
public void setDescription(String description) {
 this.description = description;
}
/**
 * @return R

RE: Indexed Properties with nested Tags

2006-11-22 Thread Raghu
I am 100% sure.
I have extensively used these futures and successful.

Using Nested Tags will decrease the Lines of Code,Easy Maintenance..

Nested tags will take care of setting the latest values to form bean .There
will not be any change in ActionForm/Action class.

Framework will take care of setting the data to actionform for nested
properties from nested tags.

Form bean may have getters and setter of scalar types(string,int...) or
nested types(user defined object,collection...).

If you have done every thing as below,Your latest values from jsp will be
set to form bean when JSP page is Submitted.



Clarification 1

Add below method in TestObject  Java Bean also.This will help you understand
the Object Content/Data during population and submit.

public String toString() {

   StringBuffer sbTemp = new StringBuffer();
   sbTemp.append("{");

   sbTemp.append("description=" );
   sbTemp.append(description);
sbTemp.append("numProducts =" );
   sbTemp.append(numProducts );


   sbTemp.append("}");
   return sbTemp.toString();

  }//end of toString

Clarification 2

System .out.println is added in order to make you understand that when JSP
is submitted you will have latest data in arlResults collection in
actionform.


Regards,
Raghu



  -Original Message-
  From: Adam K [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 22, 2006 10:16 PM
  To: [EMAIL PROTECTED]
  Cc: Struts Users Mailing List
  Subject: Re: Indexed Properties with nested Tags


  I should also like to say that the one part that seems to be giving me the
most problem is the setting of the variables in action when it is submitted.
  The other thing I am curious about is if what I am doing is incorrect.  I
am using one action for both the submit as well as the prepopulate based on
a url parameter.

  thanks once again.
  Adam


  On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:
Thanks for the lengthy example, but there is one part that I am
completly lost on.  I thought that the following occurred:
Click link to open page, formbean is reset aciton poppulates formbean
jsp retrieves values from the formbean.  User sees the screen prepopulated.
User modifies the information and clicks on submit.  The bean is again
reset the action is called to put information in the formbean (this is the
part I have no data) the jsp then pulls the data from the formbean.

What is the purpose of the System.out.println that you have at the end
of your action ?

thanks again,
Adam



On 11/21/06, Raghuveer < [EMAIL PROTECTED]> wrote:
  Hi Adam,

  Use the sample code as requested by you.
  You can ask me any help with nested Tags and from advanced struts




  JSP


  
  

  


  
  

  ActionForm

  public class ProdSelectionForm extends ActionForm
  {
  Collection arlResults=null; //can be arrayalist

  /**
* @return Returns the arlResults.
*/
   public Collection getResults() {
return arlResults;
   }
   /**
* @param arlResultsThe arlResultsto set.
*/
   public void setResults(Collection arlResults) {
this.arlResults= arlResults;
   }

   /**
   *
   * toString representation of object
   * @return  An instance of StringBuffer with Struts Action
Form properties
   *
   */
public String toString() {

 StringBuffer sbTemp = new StringBuffer();
 sbTemp.append("{");

 sbTemp.append("arlResults=" );
 sbTemp.append(arlResults);
 sbTemp.append("}");
 return sbTemp.toString();

}//end of toString
  }//end Actionform

  TestObject  Java Bean

  import java.io.Serializable;

  public class TestObject implements Serializable

  String description =null;
  int numProducts =0;
  /**
   * @return Returns the description.
   */
  public String getDescription() {
   return description;
  }
  /**
   * @param description The description to set.
   */
  public void setDescription(String description) {
   this.description = description;
  }
  /**
   * @return Returns the numProducts.
   */
  public int getNumProducts() {
   return numProducts;
  }
  /**
   * @param numProducts The numProducts to set.
   */
  public void setNumProducts(int numProducts) {
   this.numProducts = numProducts;
  }

  }//end object


  Action Class (loading the page)


  ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;

  com.test.javabeans.TestObject obj1=new com.test.javabeans.TestObject
();
  obj1.setDescription("desc1");
  obj1.setNumProducts (1);

  com.test.javabeans.TestObject obj2=new com.test.javabeans.TestObject
();
  

Re: Indexed Properties with nested Tags

2006-11-22 Thread Adam K

Alright, I guess I should have thought that.  I was worried that my
fundamental understanding for this was wrong.  For debugging I am putting my
information into a String which is not being iterated (it for some reason
always works, but those that are iterated over don't for some reason.
I have no problem prepopulating, and no problem showing the form again, it's
only when I try to have what the user inputs get placed into the form that
is where I am lost.


thanks once again for all the help everyone, sorry if I sound like a broken
record.

On 11/22/06, Dave Newton <[EMAIL PROTECTED]> wrote:


From: Adam K [mailto:[EMAIL PROTECTED]
> What is the purpose of the System.out.println that you have at the end
> of your action ?

Debugging?

Dave

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




RE: Indexed Properties with nested Tags

2006-11-22 Thread Dave Newton
From: Adam K [mailto:[EMAIL PROTECTED]
> What is the purpose of the System.out.println that you have at the end
> of your action ?

Debugging?

Dave

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



Re: Indexed Properties with nested Tags

2006-11-22 Thread Adam K

I should also like to say that the one part that seems to be giving me the
most problem is the setting of the variables in action when it is
submitted.
The other thing I am curious about is if what I am doing is incorrect.  I am
using one action for both the submit as well as the prepopulate based on a
url parameter.

thanks once again.
Adam

On 11/22/06, Adam K <[EMAIL PROTECTED]> wrote:


Thanks for the lengthy example, but there is one part that I am completly
lost on.  I thought that the following occurred:
Click link to open page, formbean is reset aciton poppulates formbean jsp
retrieves values from the formbean.  User sees the screen prepopulated.
User modifies the information and clicks on submit.  The bean is again
reset the action is called to put information in the formbean (this is the
part I have no data) the jsp then pulls the data from the formbean.

What is the purpose of the System.out.println that you have at the end of
your action ?

thanks again,
Adam

On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
>
>  Hi Adam,
>
> Use the sample code as requested by you.
> You can ask me any help with nested Tags and from advanced struts
>
>
>
>
> *JSP*
>
>
> 
>  id="Result" type="com.test.javabeans.TestObject">
>   
> 
> 
>   
> 
> 
>
> *ActionForm*
> **
> public class ProdSelectionForm extends ActionForm
> {
> Collection arlResults=null; //can be arrayalist
>
> /**
>   * @return Returns the arlResults.
>   */
>  public Collection getResults() {
>   return arlResults;
>  }
>  /**
>   * @param arlResultsThe arlResultsto set.
>   */
>  public void setResults(Collection arlResults) {
>   this.arlResults= arlResults;
>  }
>
>  /**
>  *
>  * toString representation of object
>  * @return  An instance of StringBuffer with Struts Action Form
> properties
>  *
>  */
>   public String toString() {
>
>StringBuffer sbTemp = new StringBuffer();
>sbTemp.append("{");
>
>sbTemp.append("arlResults=" );
>sbTemp.append(arlResults);
>sbTemp.append("}");
>return sbTemp.toString();
>
>   }//end of toString
> }//end Actionform
>
> *TestObject  Java Bean*
>
> import java.io.Serializable;
>
> public class TestObject implements Serializable
>
> String description =null;
> int numProducts =0;
> /**
>  * @return Returns the description.
>  */
> public String getDescription() {
>  return description;
> }
> /**
>  * @param description The description to set.
>  */
> public void setDescription(String description) {
>  this.description = description;
> }
> /**
>  * @return Returns the numProducts.
>  */
> public int getNumProducts() {
>  return numProducts;
> }
> /**
>  * @param numProducts The numProducts to set.
>  */
> public void setNumProducts(int numProducts) {
>  this.numProducts = numProducts;
> }
>
> }//end object
> **
>
> *Action Class (loading the page)*
> **
> **
> ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;
> com.test.javabeans.TestObject obj1=new com.test.javabeans.TestObject ();
> obj1.setDescription("desc1");
> obj1.setNumProducts (1);
>
>  com.test.javabeans.TestObject obj2=new com.test.javabeans.TestObject();
> obj1.setDescription("desc2");
> obj1.setNumProducts (2);
>
> ArrayList arlResults=new ArrayList ();
> arlResults.add(obj1);
> arlResults.add(obj2);
>
> prodSelectionForm.setResults(arlResults);
>
> *Action Class (Submitting the page)*
>
> When you submit the page just print the actionform you wouyld see the
> updated results of description ,numproducts in action
>
> ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;
>
> System.out.println("prodSelectionForm="+prodSelectionForm);
>
>
>
> Regards
> Raghu
>
> -Original Message-
> *From:* Adam K [mailto:[EMAIL PROTECTED]
> *Sent:* Wednesday, November 22, 2006 3:06 AM
> *To:* [EMAIL PROTECTED]
> *Cc:* Struts Users Mailing List
> *Subject:* Re: Indexed Properties
>
> If you might be able to provide a sample I would be very greatful.
> As it stands I have come up with the following :
> changing the JSP to :
>
> 
>  id="Result">
>   
>  indexed="true" /> 
>   
> 
> 
>
> Result seemed more natural as it is a single element of the results.
> All I want to be able to do is pull 3 things out of an object, display
> them in a scope of request, and allow the user to update the list and submit
> the form and have the changes be picked up - who would 

Re: Indexed Properties with nested Tags

2006-11-22 Thread Adam K

Thanks for the lengthy example, but there is one part that I am completly
lost on.  I thought that the following occurred:
Click link to open page, formbean is reset aciton poppulates formbean jsp
retrieves values from the formbean.  User sees the screen prepopulated.
User modifies the information and clicks on submit.  The bean is again reset
the action is called to put information in the formbean (this is the part I
have no data) the jsp then pulls the data from the formbean.

What is the purpose of the System.out.println that you have at the end of
your action ?

thanks again,
Adam

On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:


 Hi Adam,

Use the sample code as requested by you.
You can ask me any help with nested Tags and from advanced struts




*JSP*




  


  



*ActionForm*
**
public class ProdSelectionForm extends ActionForm
{
Collection arlResults=null; //can be arrayalist

/**
  * @return Returns the arlResults.
  */
 public Collection getResults() {
  return arlResults;
 }
 /**
  * @param arlResultsThe arlResultsto set.
  */
 public void setResults(Collection arlResults) {
  this.arlResults= arlResults;
 }

 /**
 *
 * toString representation of object
 * @return  An instance of StringBuffer with Struts Action Form
properties
 *
 */
  public String toString() {

   StringBuffer sbTemp = new StringBuffer();
   sbTemp.append("{");

   sbTemp.append("arlResults=" );
   sbTemp.append(arlResults);
   sbTemp.append("}");
   return sbTemp.toString();

  }//end of toString
}//end Actionform

*TestObject  Java Bean*

import java.io.Serializable;

public class TestObject implements Serializable

String description =null;
int numProducts =0;
/**
 * @return Returns the description.
 */
public String getDescription() {
 return description;
}
/**
 * @param description The description to set.
 */
public void setDescription(String description) {
 this.description = description;
}
/**
 * @return Returns the numProducts.
 */
public int getNumProducts() {
 return numProducts;
}
/**
 * @param numProducts The numProducts to set.
 */
public void setNumProducts(int numProducts) {
 this.numProducts = numProducts;
}

}//end object
**

*Action Class (loading the page)*
**
**
ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;
com.test.javabeans.TestObject obj1=new com.test.javabeans.TestObject ();
obj1.setDescription("desc1");
obj1.setNumProducts (1);

 com.test.javabeans.TestObject obj2=new com.test.javabeans.TestObject ();
obj1.setDescription("desc2");
obj1.setNumProducts (2);

ArrayList arlResults=new ArrayList ();
arlResults.add(obj1);
arlResults.add(obj2);

prodSelectionForm.setResults(arlResults);

*Action Class (Submitting the page)*

When you submit the page just print the actionform you wouyld see the
updated results of description ,numproducts in action

ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;

System.out.println("prodSelectionForm="+prodSelectionForm);



Regards
Raghu

-Original Message-
*From:* Adam K [mailto:[EMAIL PROTECTED]
*Sent:* Wednesday, November 22, 2006 3:06 AM
*To:* [EMAIL PROTECTED]
*Cc:* Struts Users Mailing List
*Subject:* Re: Indexed Properties

If you might be able to provide a sample I would be very greatful.
As it stands I have come up with the following :
changing the JSP to :



  
 
  



Result seemed more natural as it is a single element of the results.
All I want to be able to do is pull 3 things out of an object, display
them in a scope of request, and allow the user to update the list and submit
the form and have the changes be picked up - who would have thought that
would be so incredibly complex ?
*Note*  The part that leads me to believe it's a misunderstanding of the
tags involved is that I can get a single textfield to work perfectly, with
all the requirements (other than it being an object with multiple
properties).


On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
>
> hi Adam,
>
> I understand description,numProducts are properties in User defined
> Object/java bean in results(getResults(),setResults(..)) Collection in
> your
> actionForm.
>
> For this kind of requirments there will not be any change in actionform
> even
> though ,complixety increases in nesting..
>
> Solution is to use Nested Tags.
>
> Nested tags are used for nesting a object inside the other.
>
> In your requirment "results" is a nested property in your actionform.
> "results" collection  has a collection of objects.
>
> I have used Nested tags for most complex requirments and succeeded.
>
> Nested Tags is the real power of Struts...
>
>
> Regards
> Raghu
>
>
>
>
>
> -Original Message-
> From: Adam K [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 18, 2006 2:55 

RE: Indexed Properties with nested Tags

2006-11-21 Thread Raghuveer
Hi Adam,

Use the sample code as requested by you.
You can ask me any help with nested Tags and from advanced struts




JSP




  


  



ActionForm

public class ProdSelectionForm extends ActionForm
{
Collection arlResults=null; //can be arrayalist

/**
  * @return Returns the arlResults.
  */
 public Collection getResults() {
  return arlResults;
 }
 /**
  * @param arlResultsThe arlResultsto set.
  */
 public void setResults(Collection arlResults) {
  this.arlResults= arlResults;
 }

 /**
 *
 * toString representation of object
 * @return  An instance of StringBuffer with Struts Action Form
properties
 *
 */
  public String toString() {

   StringBuffer sbTemp = new StringBuffer();
   sbTemp.append("{");

   sbTemp.append("arlResults=" );
   sbTemp.append(arlResults);
   sbTemp.append("}");
   return sbTemp.toString();

  }//end of toString
}//end Actionform

TestObject  Java Bean

import java.io.Serializable;

public class TestObject implements Serializable

String description =null;
int numProducts =0;
/**
 * @return Returns the description.
 */
public String getDescription() {
 return description;
}
/**
 * @param description The description to set.
 */
public void setDescription(String description) {
 this.description = description;
}
/**
 * @return Returns the numProducts.
 */
public int getNumProducts() {
 return numProducts;
}
/**
 * @param numProducts The numProducts to set.
 */
public void setNumProducts(int numProducts) {
 this.numProducts = numProducts;
}

}//end object


Action Class (loading the page)


ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;

com.test.javabeans.TestObject obj1=new com.test.javabeans.TestObject ();
obj1.setDescription("desc1");
obj1.setNumProducts (1);

com.test.javabeans.TestObject obj2=new com.test.javabeans.TestObject ();
obj1.setDescription("desc2");
obj1.setNumProducts (2);

ArrayList arlResults=new ArrayList ();
arlResults.add(obj1);
arlResults.add(obj2);

prodSelectionForm.setResults(arlResults);

Action Class (Submitting the page)

When you submit the page just print the actionform you wouyld see the
updated results of description ,numproducts in action

ProdSelectionForm prodSelectionForm= (ProdSelectionForm) form;

System.out.println("prodSelectionForm="+prodSelectionForm);



Regards
Raghu
  -Original Message-
  From: Adam K [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 22, 2006 3:06 AM
  To: [EMAIL PROTECTED]
  Cc: Struts Users Mailing List
  Subject: Re: Indexed Properties


  If you might be able to provide a sample I would be very greatful.
  As it stands I have come up with the following :
  changing the JSP to :

  
  

   

  
  

  Result seemed more natural as it is a single element of the results.
  All I want to be able to do is pull 3 things out of an object, display
them in a scope of request, and allow the user to update the list and submit
the form and have the changes be picked up - who would have thought that
would be so incredibly complex ?
  *Note*  The part that leads me to believe it's a misunderstanding of the
tags involved is that I can get a single textfield to work perfectly, with
all the requirements (other than it being an object with multiple
properties).



  On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:
hi Adam,

I understand description,numProducts are properties in User defined
Object/java bean in results(getResults(),setResults(..)) Collection in
your
actionForm.

For this kind of requirments there will not be any change in actionform
even
though ,complixety increases in nesting..

Solution is to use Nested Tags.

Nested tags are used for nesting a object inside the other.

In your requirment "results" is a nested property in your actionform.
"results" collection  has a collection of objects.

I have used Nested tags for most complex requirments and succeeded.

Nested Tags is the real power of Struts...


Regards
Raghu





-Original Message-
From: Adam K [mailto:[EMAIL PROTECTED]
    Sent: Saturday, November 18, 2006 2:55 AM
To: Struts Users Mailing List
Subject: Re: Indexed Properties


Thanks for the suggestion I'll keep trying things and see what I can get
from it.


On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
>
> Lots of people have done it.  Search the archives [1]. Search for
> "indexed" and "lazyList".   I've done it with both ActionForm and
> DynaActionForm.
>
> Hubert
>
> [1] http://struts.apache.org/mail.html
>
> On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > I think I have found the problem - or at least a potential cause.
Would
> it
> > be corre

RE: Indexed Properties

2006-11-21 Thread Raghuveer
hi Adam,

I understand description,numProducts are properties in User defined
Object/java bean in results(getResults(),setResults(..)) Collection in your
actionForm.

For this kind of requirments there will not be any change in actionform even
though ,complixety increases in nesting..

Solution is to use Nested Tags.

Nested tags are used for nesting a object inside the other.

In your requirment "results" is a nested property in your actionform.
"results" collection  has a collection of objects.

I have used Nested tags for most complex requirments and succeeded.

Nested Tags is the real power of Struts...


Regards
Raghu





-Original Message-
From: Adam K [mailto:[EMAIL PROTECTED]
Sent: Saturday, November 18, 2006 2:55 AM
To: Struts Users Mailing List
Subject: Re: Indexed Properties


Thanks for the suggestion I'll keep trying things and see what I can get
from it.


On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
>
> Lots of people have done it.  Search the archives [1]. Search for
> "indexed" and "lazyList".   I've done it with both ActionForm and
> DynaActionForm.
>
> Hubert
>
> [1] http://struts.apache.org/mail.html
>
> On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > I think I have found the problem - or at least a potential cause.  Would
> it
> > be correct in stating that this will not work using ActionForm (what I
> was
> > using)  and that I must instead use DynaActionForm ?
> >
> > Thanks for the time thus far.
> >
> >
> > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > Adam,
> > >
> > > Try adding a getResultsPage() that doesn't take params and always
> > > returns a valid collection.  (Throw in the setResultsPage() that
> > > accepts a collection as well.)
> > >
> > > Hubert
> > >
> > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > This has been driving me nuts for the past little bit.
> > > > I have a page that is populated using indexed properties.  The
> > > prepopulation
> > > > works  fine, and I get the results as I would expect them, but
> trying to
> > > > submit the form I get an index out of bounds exception.  I know that
> it
> > > is
> > > > being caused because the page doesn't have the arrayList to use in
> the
> > > > indexed properties.   I guess my question boils down to using
> indexed
> > > > properties properly.  I will start by putting in an explanation of
> what
> > > I
> > > > have and what I am trying to do:
> > > >
> > > > The following is what I am working with :
> > > > JSP:
> > > >
> > > > 
> > > >  > > > id="ResultsPage">
> > > > 
> > > >  > > property="description"
> > > > />
> > > >  > > property="numProducts"
> > > > indexed="true" /> 
> > > > 
> > > > 
> > > > 
> > > >
> > > > What I am trying to achieve is that a user clicks on a link, they
> are
> > > sent
> > > > to page, and all of the values are prepopulated.  The page is then
> > > displayed
> > > > and the user has the option to modify any of the variables that they
> > > want to
> > > > before resubmitting the page.  (When they resubmit the form has a
> url
> > > > parameter attached to it).  What is happening (or at least what I
> > > believe is
> > > > happening is the following:  link is clicked, reset is called action
> > > sets
> > > > the variables, page is displayed, user can modify the page and
> resubmit,
> > > > reset is called on the form, the action is called (this is where it
> dies
> > > as
> > > > there is no longer an ArrayList) to modify.  My question is am I
> going
> > > about
> > > > this in a manner that seems sensible or am I way off base ?  I have
> the
> > > > values being prepopulated, but when trying to use the values that
> the
> > > user
> > > > puts in I can't use them in the action, nor can I pull the values
> from
> > > the
> > > > form without again setting the values in the form.   I am hoping it
> is
> > > that
> > > > I have over looked something, but it's possible that I don't
> understand
> > > > something as well.

Re: Indexed Properties

2006-11-21 Thread Adam K

If you might be able to provide a sample I would be very greatful.
As it stands I have come up with the following :
changing the JSP to :


   
 

 
   


Result seemed more natural as it is a single element of the results.
All I want to be able to do is pull 3 things out of an object, display them
in a scope of request, and allow the user to update the list and submit the
form and have the changes be picked up - who would have thought that would
be so incredibly complex ?
*Note*  The part that leads me to believe it's a misunderstanding of the
tags involved is that I can get a single textfield to work perfectly, with
all the requirements (other than it being an object with multiple
properties).


On 11/21/06, Raghuveer <[EMAIL PROTECTED]> wrote:


hi Adam,

I understand description,numProducts are properties in User defined
Object/java bean in results(getResults(),setResults(..)) Collection in
your
actionForm.

For this kind of requirments there will not be any change in actionform
even
though ,complixety increases in nesting..

Solution is to use Nested Tags.

Nested tags are used for nesting a object inside the other.

In your requirment "results" is a nested property in your actionform.
"results" collection  has a collection of objects.

I have used Nested tags for most complex requirments and succeeded.

Nested Tags is the real power of Struts...


Regards
Raghu





-Original Message-
From: Adam K [mailto:[EMAIL PROTECTED]
Sent: Saturday, November 18, 2006 2:55 AM
To: Struts Users Mailing List
Subject: Re: Indexed Properties


Thanks for the suggestion I'll keep trying things and see what I can get
from it.


On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
>
> Lots of people have done it.  Search the archives [1]. Search for
> "indexed" and "lazyList".   I've done it with both ActionForm and
> DynaActionForm.
>
> Hubert
>
> [1] http://struts.apache.org/mail.html
>
> On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > I think I have found the problem - or at least a potential
cause.  Would
> it
> > be correct in stating that this will not work using ActionForm (what I
> was
> > using)  and that I must instead use DynaActionForm ?
> >
> > Thanks for the time thus far.
> >
> >
> > On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> > >
> > > Adam,
> > >
> > > Try adding a getResultsPage() that doesn't take params and always
> > > returns a valid collection.  (Throw in the setResultsPage() that
> > > accepts a collection as well.)
> > >
> > > Hubert
> > >
> > > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > > This has been driving me nuts for the past little bit.
> > > > I have a page that is populated using indexed properties.  The
> > > prepopulation
> > > > works  fine, and I get the results as I would expect them, but
> trying to
> > > > submit the form I get an index out of bounds exception.  I know
that
> it
> > > is
> > > > being caused because the page doesn't have the arrayList to use in
> the
> > > > indexed properties.   I guess my question boils down to using
> indexed
> > > > properties properly.  I will start by putting in an explanation of
> what
> > > I
> > > > have and what I am trying to do:
> > > >
> > > > The following is what I am working with :
> > > > JSP:
> > > >
> > > > 
> > > >  > > > id="ResultsPage">
> > > > 
> > > >  > > property="description"
> > > > />
> > > >  > > property="numProducts"
> > > > indexed="true" /> 
> > > > 
> > > > 
> > > > 
> > > >
> > > > What I am trying to achieve is that a user clicks on a link, they
> are
> > > sent
> > > > to page, and all of the values are prepopulated.  The page is then
> > > displayed
> > > > and the user has the option to modify any of the variables that
they
> > > want to
> > > > before resubmitting the page.  (When they resubmit the form has a
> url
> > > > parameter attached to it).  What is happening (or at least what I
> > > believe is
> > > > happening is the following:  link is clicked, reset is called
action
> > > sets
> > > > the variables, page is displayed, user can modify the page and
> resubmit,
> > > > reset 

Re: Indexed Properties

2006-11-17 Thread Adam K

Thanks for the suggestion I'll keep trying things and see what I can get
from it.


On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:


Lots of people have done it.  Search the archives [1]. Search for
"indexed" and "lazyList".   I've done it with both ActionForm and
DynaActionForm.

Hubert

[1] http://struts.apache.org/mail.html

On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> I think I have found the problem - or at least a potential cause.  Would
it
> be correct in stating that this will not work using ActionForm (what I
was
> using)  and that I must instead use DynaActionForm ?
>
> Thanks for the time thus far.
>
>
> On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
> >
> > Adam,
> >
> > Try adding a getResultsPage() that doesn't take params and always
> > returns a valid collection.  (Throw in the setResultsPage() that
> > accepts a collection as well.)
> >
> > Hubert
> >
> > On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > > This has been driving me nuts for the past little bit.
> > > I have a page that is populated using indexed properties.  The
> > prepopulation
> > > works  fine, and I get the results as I would expect them, but
trying to
> > > submit the form I get an index out of bounds exception.  I know that
it
> > is
> > > being caused because the page doesn't have the arrayList to use in
the
> > > indexed properties.   I guess my question boils down to using
indexed
> > > properties properly.  I will start by putting in an explanation of
what
> > I
> > > have and what I am trying to do:
> > >
> > > The following is what I am working with :
> > > JSP:
> > >
> > > 
> > >  > > id="ResultsPage">
> > > 
> > >  > property="description"
> > > />
> > >  > property="numProducts"
> > > indexed="true" /> 
> > > 
> > > 
> > > 
> > >
> > > What I am trying to achieve is that a user clicks on a link, they
are
> > sent
> > > to page, and all of the values are prepopulated.  The page is then
> > displayed
> > > and the user has the option to modify any of the variables that they
> > want to
> > > before resubmitting the page.  (When they resubmit the form has a
url
> > > parameter attached to it).  What is happening (or at least what I
> > believe is
> > > happening is the following:  link is clicked, reset is called action
> > sets
> > > the variables, page is displayed, user can modify the page and
resubmit,
> > > reset is called on the form, the action is called (this is where it
dies
> > as
> > > there is no longer an ArrayList) to modify.  My question is am I
going
> > about
> > > this in a manner that seems sensible or am I way off base ?  I have
the
> > > values being prepopulated, but when trying to use the values that
the
> > user
> > > puts in I can't use them in the action, nor can I pull the values
from
> > the
> > > form without again setting the values in the form.   I am hoping it
is
> > that
> > > I have over looked something, but it's possible that I don't
understand
> > > something as well.
> > >
> > > Here is the Action code (This is the entire execute method) :
> > > HttpSession session = request.getSession();
> > > ProdSelectionForm prodSelection = (ProdSelectionForm) form;
> > > User user ;
> > > user = (User)session.getAttribute("User");
> > > Order order = new Order();
> > > ArrayList products = new ArrayList();
> > > ArrayList pageRes = new ArrayList();
> > > ArrayList results = new ArrayList();
> > >
> > > String action = (request.getParameter("Dest") == null ?
> > "populate" :
> > > request.getParameter("Dest")   );
> > >
> > > order = user.getCurrOrder(user);
> > >
> > > if(action.equals("populate"))
> > > {
> > > prodSelection.setResults(order.getProducts());
> > > }
> > >
> > > if(action.equals("Delete"))
> > > {
> > > ArrayList p = new ArrayList();
> > > p = prodSelection.getResults();
> > >
> > > int count = 0;
> > > while (count < p.size())
> > > {
> > > Product t  = (Product) p.get(count);
> > > t.setDescription("" +t.getNumProducts() +">"
> > +pageRes.size()
> > > +"<");
> > > p.set(count, t);
> > > count++;
> > > }
> > >
> > > t.setDescription("" +t.getNumProducts() +">" +p.size()
> > +"<");
> > > p.set(0, t);
> > >
> > > user.setOrder(p , user);
> > > prodSelection.setResults(p);
> > > prodSelection.setTest(prodSelection.getTest()+" + " +
p.size
> > ());
> > >
> > > return mapping.findForward("success");
> > > }
> > > return mapping.findForward("success");
> > >
> > >
> > >
> > >
> > > Form code: (In the form code is an ArrayList called results.  This
> > arraylist
> > > contains  a bunch of Product )
> > >
> > > public Product getResultsPage(

Re: Indexed Properties

2006-11-17 Thread Hubert Rabago

Lots of people have done it.  Search the archives [1]. Search for
"indexed" and "lazyList".   I've done it with both ActionForm and
DynaActionForm.

Hubert

[1] http://struts.apache.org/mail.html

On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:

I think I have found the problem - or at least a potential cause.  Would it
be correct in stating that this will not work using ActionForm (what I was
using)  and that I must instead use DynaActionForm ?

Thanks for the time thus far.


On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:
>
> Adam,
>
> Try adding a getResultsPage() that doesn't take params and always
> returns a valid collection.  (Throw in the setResultsPage() that
> accepts a collection as well.)
>
> Hubert
>
> On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> > This has been driving me nuts for the past little bit.
> > I have a page that is populated using indexed properties.  The
> prepopulation
> > works  fine, and I get the results as I would expect them, but trying to
> > submit the form I get an index out of bounds exception.  I know that it
> is
> > being caused because the page doesn't have the arrayList to use in the
> > indexed properties.   I guess my question boils down to using indexed
> > properties properly.  I will start by putting in an explanation of what
> I
> > have and what I am trying to do:
> >
> > The following is what I am working with :
> > JSP:
> >
> > 
> >  > id="ResultsPage">
> > 
> >  property="description"
> > />
> >  property="numProducts"
> > indexed="true" /> 
> > 
> > 
> > 
> >
> > What I am trying to achieve is that a user clicks on a link, they are
> sent
> > to page, and all of the values are prepopulated.  The page is then
> displayed
> > and the user has the option to modify any of the variables that they
> want to
> > before resubmitting the page.  (When they resubmit the form has a url
> > parameter attached to it).  What is happening (or at least what I
> believe is
> > happening is the following:  link is clicked, reset is called action
> sets
> > the variables, page is displayed, user can modify the page and resubmit,
> > reset is called on the form, the action is called (this is where it dies
> as
> > there is no longer an ArrayList) to modify.  My question is am I going
> about
> > this in a manner that seems sensible or am I way off base ?  I have the
> > values being prepopulated, but when trying to use the values that the
> user
> > puts in I can't use them in the action, nor can I pull the values from
> the
> > form without again setting the values in the form.   I am hoping it is
> that
> > I have over looked something, but it's possible that I don't understand
> > something as well.
> >
> > Here is the Action code (This is the entire execute method) :
> > HttpSession session = request.getSession();
> > ProdSelectionForm prodSelection = (ProdSelectionForm) form;
> > User user ;
> > user = (User)session.getAttribute("User");
> > Order order = new Order();
> > ArrayList products = new ArrayList();
> > ArrayList pageRes = new ArrayList();
> > ArrayList results = new ArrayList();
> >
> > String action = (request.getParameter("Dest") == null ?
> "populate" :
> > request.getParameter("Dest")   );
> >
> > order = user.getCurrOrder(user);
> >
> > if(action.equals("populate"))
> > {
> > prodSelection.setResults(order.getProducts());
> > }
> >
> > if(action.equals("Delete"))
> > {
> > ArrayList p = new ArrayList();
> > p = prodSelection.getResults();
> >
> > int count = 0;
> > while (count < p.size())
> > {
> > Product t  = (Product) p.get(count);
> > t.setDescription("" +t.getNumProducts() +">"
> +pageRes.size()
> > +"<");
> > p.set(count, t);
> > count++;
> > }
> >
> > t.setDescription("" +t.getNumProducts() +">" +p.size()
> +"<");
> > p.set(0, t);
> >
> > user.setOrder(p , user);
> > prodSelection.setResults(p);
> > prodSelection.setTest(prodSelection.getTest()+" + " + p.size
> ());
> >
> > return mapping.findForward("success");
> > }
> > return mapping.findForward("success");
> >
> >
> >
> >
> > Form code: (In the form code is an ArrayList called results.  This
> arraylist
> > contains  a bunch of Product )
> >
> > public Product getResultsPage(int index)
> > {
> > if(this.results == null)
> > {
> > this.results = new ArrayList();
> > }
> >
> > while(index >= this.results.size())
> > {
> > this.results.add(new Product());
> > }
> > return (Product) results.get(index);
> > }
> >
> > public void setResultsPage(int index, Product p)
> > {
> >  

Re: Indexed Properties

2006-11-17 Thread Adam K

I think I have found the problem - or at least a potential cause.  Would it
be correct in stating that this will not work using ActionForm (what I was
using)  and that I must instead use DynaActionForm ?

Thanks for the time thus far.


On 11/17/06, Hubert Rabago <[EMAIL PROTECTED]> wrote:


Adam,

Try adding a getResultsPage() that doesn't take params and always
returns a valid collection.  (Throw in the setResultsPage() that
accepts a collection as well.)

Hubert

On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:
> This has been driving me nuts for the past little bit.
> I have a page that is populated using indexed properties.  The
prepopulation
> works  fine, and I get the results as I would expect them, but trying to
> submit the form I get an index out of bounds exception.  I know that it
is
> being caused because the page doesn't have the arrayList to use in the
> indexed properties.   I guess my question boils down to using indexed
> properties properly.  I will start by putting in an explanation of what
I
> have and what I am trying to do:
>
> The following is what I am working with :
> JSP:
>
> 
>  id="ResultsPage">
> 
>  />
>  indexed="true" /> 
> 
> 
> 
>
> What I am trying to achieve is that a user clicks on a link, they are
sent
> to page, and all of the values are prepopulated.  The page is then
displayed
> and the user has the option to modify any of the variables that they
want to
> before resubmitting the page.  (When they resubmit the form has a url
> parameter attached to it).  What is happening (or at least what I
believe is
> happening is the following:  link is clicked, reset is called action
sets
> the variables, page is displayed, user can modify the page and resubmit,
> reset is called on the form, the action is called (this is where it dies
as
> there is no longer an ArrayList) to modify.  My question is am I going
about
> this in a manner that seems sensible or am I way off base ?  I have the
> values being prepopulated, but when trying to use the values that the
user
> puts in I can't use them in the action, nor can I pull the values from
the
> form without again setting the values in the form.   I am hoping it is
that
> I have over looked something, but it's possible that I don't understand
> something as well.
>
> Here is the Action code (This is the entire execute method) :
> HttpSession session = request.getSession();
> ProdSelectionForm prodSelection = (ProdSelectionForm) form;
> User user ;
> user = (User)session.getAttribute("User");
> Order order = new Order();
> ArrayList products = new ArrayList();
> ArrayList pageRes = new ArrayList();
> ArrayList results = new ArrayList();
>
> String action = (request.getParameter("Dest") == null ?
"populate" :
> request.getParameter("Dest")   );
>
> order = user.getCurrOrder(user);
>
> if(action.equals("populate"))
> {
> prodSelection.setResults(order.getProducts());
> }
>
> if(action.equals("Delete"))
> {
> ArrayList p = new ArrayList();
> p = prodSelection.getResults();
>
> int count = 0;
> while (count < p.size())
> {
> Product t  = (Product) p.get(count);
> t.setDescription("" +t.getNumProducts() +">"
+pageRes.size()
> +"<");
> p.set(count, t);
> count++;
> }
>
> t.setDescription("" +t.getNumProducts() +">" +p.size()
+"<");
> p.set(0, t);
>
> user.setOrder(p , user);
> prodSelection.setResults(p);
> prodSelection.setTest(prodSelection.getTest()+" + " + p.size
());
>
> return mapping.findForward("success");
> }
> return mapping.findForward("success");
>
>
>
>
> Form code: (In the form code is an ArrayList called results.  This
arraylist
> contains  a bunch of Product )
>
> public Product getResultsPage(int index)
> {
> if(this.results == null)
> {
> this.results = new ArrayList();
> }
>
> while(index >= this.results.size())
> {
> this.results.add(new Product());
> }
> return (Product) results.get(index);
> }
>
> public void setResultsPage(int index, Product p)
> {
> if(this.results == null)
> {
> this.results = new ArrayList();
> }
>
> while(index >= this.results.size())
> {
> this.results.add(new Product());
> }
> results.set(index, p);
> //return (Product) results.get(index);
> }
>
> public void setResults(ArrayList results)
> {
>this.results=results;
> }
>
> public ArrayList getResults()
> {
>return this.results;
> }
>
>
>
> Products is an object that stores various things about a product

Re: Indexed Properties

2006-11-17 Thread Hubert Rabago

Adam,

Try adding a getResultsPage() that doesn't take params and always
returns a valid collection.  (Throw in the setResultsPage() that
accepts a collection as well.)

Hubert

On 11/17/06, Adam K <[EMAIL PROTECTED]> wrote:

This has been driving me nuts for the past little bit.
I have a page that is populated using indexed properties.  The prepopulation
works  fine, and I get the results as I would expect them, but trying to
submit the form I get an index out of bounds exception.  I know that it is
being caused because the page doesn't have the arrayList to use in the
indexed properties.   I guess my question boils down to using indexed
properties properly.  I will start by putting in an explanation of what I
have and what I am trying to do:

The following is what I am working with :
JSP:





 




What I am trying to achieve is that a user clicks on a link, they are sent
to page, and all of the values are prepopulated.  The page is then displayed
and the user has the option to modify any of the variables that they want to
before resubmitting the page.  (When they resubmit the form has a url
parameter attached to it).  What is happening (or at least what I believe is
happening is the following:  link is clicked, reset is called action sets
the variables, page is displayed, user can modify the page and resubmit,
reset is called on the form, the action is called (this is where it dies as
there is no longer an ArrayList) to modify.  My question is am I going about
this in a manner that seems sensible or am I way off base ?  I have the
values being prepopulated, but when trying to use the values that the user
puts in I can't use them in the action, nor can I pull the values from the
form without again setting the values in the form.   I am hoping it is that
I have over looked something, but it's possible that I don't understand
something as well.

Here is the Action code (This is the entire execute method) :
HttpSession session = request.getSession();
ProdSelectionForm prodSelection = (ProdSelectionForm) form;
User user ;
user = (User)session.getAttribute("User");
Order order = new Order();
ArrayList products = new ArrayList();
ArrayList pageRes = new ArrayList();
ArrayList results = new ArrayList();

String action = (request.getParameter("Dest") == null ? "populate" :
request.getParameter("Dest")   );

order = user.getCurrOrder(user);

if(action.equals("populate"))
{
prodSelection.setResults(order.getProducts());
}

if(action.equals("Delete"))
{
ArrayList p = new ArrayList();
p = prodSelection.getResults();

int count = 0;
while (count < p.size())
{
Product t  = (Product) p.get(count);
t.setDescription("" +t.getNumProducts() +">" +pageRes.size()
+"<");
p.set(count, t);
count++;
}

t.setDescription("" +t.getNumProducts() +">" +p.size() +"<");
p.set(0, t);

user.setOrder(p , user);
prodSelection.setResults(p);
prodSelection.setTest(prodSelection.getTest()+" + " + p.size());

return mapping.findForward("success");
}
return mapping.findForward("success");




Form code: (In the form code is an ArrayList called results.  This arraylist
contains  a bunch of Product )

public Product getResultsPage(int index)
{
if(this.results == null)
{
this.results = new ArrayList();
}

while(index >= this.results.size())
{
this.results.add(new Product());
}
return (Product) results.get(index);
}

public void setResultsPage(int index, Product p)
{
if(this.results == null)
{
this.results = new ArrayList();
}

while(index >= this.results.size())
{
this.results.add(new Product());
}
results.set(index, p);
//return (Product) results.get(index);
}

public void setResults(ArrayList results)
{
   this.results=results;
}

public ArrayList getResults()
{
   return this.results;
}



Products is an object that stores various things about a product with
numProducts, and description being two of those things.
Within Products is both getter and setter methods for the numProducts as
well as description.



Thanks so much for any help you may be able to provide.




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



RE: Indexed Properties

2006-11-17 Thread Juan Espinosa
Hi to all i have two questions...

First question... is possible to remove spring dependecies in struts2 or
spring stuff (jars,  applicationContext.xml and ContextLoadListener)  are
neccesary to run struts2 

Second question or advise... i want to give a try to ajax, i want some parts
of me site to be updated without reloading the whole page, for example. I
need some advise where to start, struts2 ajax support, etc...

well thats all, thanks for helping me.


Regards,

Juan Espinosa


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



Re: Indexed Properties

2006-10-23 Thread Niall Pemberton

The trick is normally to name the "id" used in the  to
the same name as the property for your "list of product" in your
ActionForm (i.e. newProducts in your example):





Which should then produce the html you're expecting:



Niall

On 10/23/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:

Hi,
I have some objects in an Array List which I want to fetch using indexed
properties. So basically in my array list I have objects of type Product,
which has properties like name,number etc. with appropriate getter and
setter methods.


What I am unable to figure out is the following.





The indexed attribute mentioned in the html text. Does it make newProducts
indexed or does it make name indexed. I mean what do i do to get


and so on...

I know I could you use scriptlets, but I was thinking if there was a cleaner
solution to the whole thing.

Thanks
--
Puneet




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



Re: Indexed Properties in Struts

2006-10-12 Thread Aftab Vhora

Hi Yadav,

have a look at below link u'll find something of ur intrest ...

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

http://www.developer.com/java/ejb/article.php/10931_3321521_1

Thanks & Regards,
Aftab Vhora



Barun Kumar Yadav wrote:


Hi
I'm using Indexed Properties with Struts and am attempting to over-ride the 
getter method of a List while trying to retrieve data.
I have an example where I use the  tag to retrieve contents of a 
List


And this code effectively calls the Getter function shown below 
public Object getStringIndexed(int index) {

return strAry.get(index);
}
And correct values are retrieved.
However, when I try to use a similar concept using the  tag,

The getter function public Object getChildAge(int index) does not get control
Has anyone encountered similar problems or does anyone know the reason for this 
?
Help will be highly appreciated

Thanks

Barun Kumar Yadav
¬Sapient  Bangalore
Work 91.804.104.7490
Mobile  91.989.197.4493
YIM   meet_you_23





 



RE: Indexed Properties. Maintaining Order

2006-09-21 Thread Strachan, Paul
Hi Puneet,

When I re-read your original mail I notice you use DHTML to add rows, so
my approach/thoughts may not be appropriate for you. 

I use DynaForms with ArrayLists of objects. In the form I use the
logic:iterate with indexed=true on the html tags. If I need to
"dynamically" add another row I do a submit (no validate) and simply add
an empty object into my List and forward back to the page.


On 9/22/06, Puneet Lakhina [mailto:[EMAIL PROTECTED] wrote:
>
> Could you please give an example of how you manage lists with indexed
> properties, that would really help.
> 
> Thanks
> -- 
> Puneet
**
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**

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



Re: Indexed Properties. Maintaining Order

2006-09-21 Thread Puneet Lakhina

On 9/21/06, Niall Pemberton <[EMAIL PROTECTED]> wrote:


As you found out there is no way of knowing the order the
browser/client will submit request parameters, so if you want to use
indexed properties in this way you need to "grow" the list to
accomodate the size of the indexed property being set.

So you could do something like the following:

  public void setDate(int index,String value) {
  while (datesList.size() <= index) {
  datesList.add(null);
   }
  datesList.set(index, value);
  }



I  kinda did this before posting as a temp fix. But I though this was like a
too inefficinet solution. But Im glad it isnt all that bad a thing :-).

Thanks a lot.
--
Puneet


Re: Indexed Properties. Maintaining Order

2006-09-21 Thread Puneet Lakhina

On 9/21/06, Strachan, Paul <[EMAIL PROTECTED]> wrote:


A List is an ordered collection so it doesnt make sense that the order
changes.  Also, depending on which Map implementation you use ordering may
not be guaranteed.



I would basically have the index in case of indexed properties as my key. SO
the question of ordering doest come
publiv void setDate(String key, String value) {
map.put(key,value);
}
This way I would always have the correct values.

I frequently use indexed properties with List and have not experienced this

problem.  You may need to check the generated html source and follow through
the request cycle.

Your method signatures for your setters dont seem appropriate in the
context of managing indexed properties on a list of objects (at least to
me).



Could you please give an example of how you manage lists with indexed
properties, that would really help.

Thanks
--
Puneet


RE: Indexed Properties. Maintaining Order

2006-09-21 Thread Strachan, Paul
A List is an ordered collection so it doesnt make sense that the order changes. 
 Also, depending on which Map implementation you use ordering may not be 
guaranteed.  I frequently use indexed properties with List and have not 
experienced this problem.  You may need to check the generated html source and 
follow through the request cycle.
 
Your method signatures for your setters dont seem appropriate in the context of 
managing indexed properties on a list of objects (at least to me).  Perhaps you 
are managing your indexed properties in a way that would better suit a Map 
implementation, but I cant tell from the provided code.



From: Puneet Lakhina [mailto:[EMAIL PROTECTED]
Sent: Thu 21/09/2006 7:43 PM
To: Struts Users Mailing List
Subject: Indexed Properties. Maintaining Order



Hi,
I have a no. of fields in a form arranged in a table of rows. I am using
indexed properties for these fields. The number of these fields isn't known
to me at the time of page loading for which I have used some DHTML to
properly add the fields. And all the values are getting submitted.
Now my problem is that the order is getting jumbled up.

My table is like this

No.   Date   Description
1.  date[0]description[0]
2.   date[1]description[1]

But after submitting, the order gets jumbled up. i.e. i get something like
this

No.   Date   Description
1.  date[0]description[1]
2.   date[1]description[0]

This I have figured is because of the following setter methods

public void setDate(int index,String value) {
datesList.add(value);
}

public void setDescription(int index,String value) {
descriptionsList.add(value);
}

So basically the order in which the setter methods are called is random. i.e.
setDate(0,value) - >  setDescription(1,value)  and so on.
Does this problem mean we have no way of maintaining order when using lists?


What I have thought of is instead of using Indexed Properties I will use
map backed properties. But if somebody can offer me some sort of solution
that doesn't require change from Lists to Map it would be great.


--
Puneet


**
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**

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



Re: Indexed Properties. Maintaining Order

2006-09-21 Thread Niall Pemberton

As you found out there is no way of knowing the order the
browser/client will submit request parameters, so if you want to use
indexed properties in this way you need to "grow" the list to
accomodate the size of the indexed property being set.

So you could do something like the following:

 public void setDate(int index,String value) {
 while (datesList.size() <= index) {
 datesList.add(null);
  }
 datesList.set(index, value);
 }

This is what LazyDynaBean / LazyDynaForm does:

http://struts.apache.org/1.x/userGuide/building_controller.html#lazy_action_form_classes

Theres also this page on the wiki:
http://wiki.apache.org/struts/StrutsCatalogLazyList

Niall

On 9/21/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:

Hi,
I have a no. of fields in a form arranged in a table of rows. I am using
indexed properties for these fields. The number of these fields isn't known
to me at the time of page loading for which I have used some DHTML to
properly add the fields. And all the values are getting submitted.
Now my problem is that the order is getting jumbled up.

My table is like this

No.   Date   Description
1.  date[0]description[0]
2.   date[1]description[1]

But after submitting, the order gets jumbled up. i.e. i get something like
this

No.   Date   Description
1.  date[0]description[1]
2.   date[1]description[0]

This I have figured is because of the following setter methods

public void setDate(int index,String value) {
datesList.add(value);
}

public void setDescription(int index,String value) {
descriptionsList.add(value);
}

So basically the order in which the setter methods are called is random. i.e.
setDate(0,value) - >  setDescription(1,value)  and so on.
Does this problem mean we have no way of maintaining order when using lists?


What I have thought of is instead of using Indexed Properties I will use
map backed properties. But if somebody can offer me some sort of solution
that doesn't require change from Lists to Map it would be great.


--
Puneet




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



RE: Indexed Properties

2006-05-15 Thread I HARIKRISHNA
Ad you have a list of checkboxes,its better to use multi box and try to reduce 
javascript code
  Harikrishna

"Vidya (Suvarna) Mahavadi" <[EMAIL PROTECTED]> wrote:
  I wonder why there are no responses today.. 

Guys, I really need help on this.. Any expert views?

-Original Message-
From: Vidya (Suvarna) Mahavadi [mailto:[EMAIL PROTECTED] 
Sent: Monday 15 May 2006 11:42
To: Struts Users Mailing List
Subject: Indexed Properties

Hi everyone!



I am having problem to use indexed properties.

I need to display a table with the list of transactions and a check box
next to each transaction which can add the transaction amount to a text
field. In my action form I have a list of displayObjects and the
displayObject is like 



public class PolicyTrnsDisplayObject implements Serializable{

private PolicyTrns policyTrns;

private boolean checked;



//getters and setters are also included

}



And PolicyTrns object has all the fields to be displayed.



public class PolicyTrns extends ValueObject implements
IPolicyTrnsTraversable

{

private long lineNo = IValueObject.NULL_PRIMITIVE;

private long policyNo = IValueObject.NULL_PRIMITIVE;

private long billTrnsNo = IValueObject.NULL_PRIMITIVE;

private long billRefNo = IValueObject.NULL_PRIMITIVE;

private Date sysDate;

private Date billingDate;

private short accountingCd = IValueObject.NULL_PRIMITIVE;

private BigDecimal amount;



//getters and setters are also included

}



My jsp displays all the details correctly. But to copy/add the amount to
a text field I am calling a javascript function to which I want to pass
the amount. My check box code looks like this.



name=" property='ctr + "].checked"%>' adjustmentRequestForm?>, this.name)"/>



I am not sure if this is the correct way of getting the amount, please
let me know if there is better way of doing it. It is displaying an
error



Exception: java.util.MissingResourceException: Can't find resource for
bundle java.util.PropertyResourceBundle, key
org.apache.struts.taglib.bean.format.float



Please help me to get it to work..



Thanks,
Vidya


This message and any attachments are confidential and intended solely
for the addressee. If you have received this message in error, please
notify Discovery immediately, telephone number +27 11 529 2888. Any
unauthorised use; alteration or dissemination of the contents of this
email is strictly prohibited. In no event will Discovery or the sender
be liable in any manner whatsoever to any person for any loss or any
direct, indirect, special or consequential damages arising from use of
this email or any linked website, including, without limitation, from
any lost profits, business interruption, loss of programmes or other
data that may be stored on any information handling system or otherwise
from any assurance that this email is virus free even if Discovery is
expressly advised of the possibility of such damages. Discovery is an
Authorised Financial Services Provider.
This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

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




-
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

RE: Indexed Properties

2006-05-15 Thread Vidya \(Suvarna\) Mahavadi
I wonder why there are no responses today.. 

Guys, I really need help on this.. Any expert views?

-Original Message-
From: Vidya (Suvarna) Mahavadi [mailto:[EMAIL PROTECTED] 
Sent: Monday 15 May 2006 11:42
To: Struts Users Mailing List
Subject: Indexed Properties

Hi everyone!

 

I am having problem to use indexed properties.

I need to display a table with the list of transactions and a check box
next to each transaction which can add the transaction amount to a text
field. In my action form I have a list of displayObjects and the
displayObject is like 

 

public class PolicyTrnsDisplayObject implements Serializable{

private PolicyTrns policyTrns;

private boolean checked;

 

//getters and setters are also included

}

 

And PolicyTrns object has all the fields to be displayed.

 

public class PolicyTrns extends ValueObject implements
IPolicyTrnsTraversable

{

private long lineNo = IValueObject.NULL_PRIMITIVE;

private long policyNo = IValueObject.NULL_PRIMITIVE;

private long billTrnsNo = IValueObject.NULL_PRIMITIVE;

private long billRefNo = IValueObject.NULL_PRIMITIVE;

private Date sysDate;

private Date billingDate;

private short accountingCd = IValueObject.NULL_PRIMITIVE;

private BigDecimal amount;

 

//getters and setters are also included

}

 

My jsp displays all the details correctly. But to copy/add the amount to
a text field I am calling a javascript function to which I want to pass
the amount. My check box code looks like this.

 

, this.name)"/>

 

I am not sure if this is the correct way of getting the amount, please
let me know if there is better way of doing it. It is displaying an
error

 

Exception: java.util.MissingResourceException: Can't find resource for
bundle java.util.PropertyResourceBundle, key
org.apache.struts.taglib.bean.format.float

 

Please help me to get it to work..

 

Thanks,
Vidya


This message and any attachments are confidential and intended solely
for the addressee. If you have received this message in error, please
notify Discovery immediately, telephone number +27 11 529 2888. Any
unauthorised use; alteration or dissemination of the contents of this
email is strictly prohibited. In no event will Discovery or the sender
be liable in any manner whatsoever to any person for any loss or any
direct, indirect, special or consequential damages arising from use of
this email or any linked website, including, without limitation, from
any lost profits, business interruption, loss of programmes or other
data that may be stored on any information handling system or otherwise
from any assurance that this email is virus free even if Discovery is
expressly advised of the possibility of such damages. Discovery is an
Authorised Financial Services Provider.
This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

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



Re: indexed properties and validation

2005-11-16 Thread Mario_Hernandez
No one??



[EMAIL PROTECTED] 
11/15/2005 04:15 PM
Please respond to
"Struts Users Mailing List" 


To
user@struts.apache.org
cc

Subject
indexed properties and validation






I've got a form with an indexed propety contained in an array list, with 
values such as ssn. It has four accessor methods
List getDependents()
DependentForm getDependent(int i)
void setDependents(List l)
void setDependent(int i, DependentForm form)

The validator makes an ActionError with a key of dependents[x].ssn if 
there's an error for a given row's ssn, but when the the html tags check 
errorStyleClass (or any of the others) it checks for dependent[x].ssn. 
>From what I understand this is common knowledge and the solution is to 
call both sets of getters and setters the same thing. However, I dont like 

the method signatures. I was wondering if anyone found a solution to this 
other than changing the method signatures.

Mario


Re: Indexed Properties with Sets

2005-05-09 Thread Rick Reumann
Matt Raible wrote the following on 5/8/2005 11:39 AM:
As an alternative, I suppose I could modify my Form -> POJO conversion 
to detect Sets and properly convert List to Set.
Unfortunately I think this is what you are going to have to do Matt. I'd 
 keep the Set property in the form bean, but use the List property in 
the html:

//ActionForm
Set someSet;
List someList;
getSomeList {
   //*gets someList from the someSet
}
setSomeList
   //sets someList
   //*also populates someSet from someList
setSomeSet
   //sets someSet
getSomeSet
   //gets someSet
Now the above should work even if your Value Object has a Set property.
--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Indexed Properties

2005-02-02 Thread Nigel Furber
Using the nested version of tags rather than html and logic worked for me.

See http://www.keyboardmonkey.com/next/index.jsp, they have some examples

and the normal Struts how-tos.

Nigel Furber


-Original Message-
From: news [mailto:[EMAIL PROTECTED] Behalf Of Peter Wu
Sent: 02 February 2005 20:41
To: user@struts.apache.org
Subject: Re: Indexed Properties


Peter Wu  gmail.com> writes:

> 
>  0-19
>  20-49
>  50-
>

This one works fine now.

> 
> 

hour[i][j] does not work.


How to make a 2-dimensional array work with Struts? Thanks in advance!


Peter


-
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

2005-02-02 Thread Peter Wu
Peter Wu  gmail.com> writes:

> 
>  0-19
>  20-49
>  50-
>

This one works fine now.

> 
> 

hour[i][j] does not work.


How to make a 2-dimensional array work with Struts? Thanks in advance!


Peter


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



RE: Indexed properties

2004-11-19 Thread David McReynolds
 

Why is struts generating a days[10] when there are only 6 days in my
collection? Better still, why is the days index tied to the
employeeAppointments index?

<%@ page language="java"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@ taglib uri="/WEB-INF/cfa-logic.tld" prefix="clogic"%>

  




  



  

  

  


 


  

  

  

  
  

-Original Message-
From: David McReynolds [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 17, 2004 4:46 PM
To: [EMAIL PROTECTED]
Subject: Indexed properties

I am getting the nested beans out of my form ok but saving gives no joy.
I am trying to use the "2.1 Hand Cranking lazy List in the ActionForm"
from http://wiki.apache.org/struts/StrutsCatalogLazyList. However, I
never see my log messages from the indexed getter methods for any of the
nested beans.



  

  

  

  


The form has a collection of DayOfWeekBeans called days.
Each DOW bean has a collection of WorkgroupBeans called workgroups.
Each WG bean has a collection of EmployeeAppointmentBeans called
employeeAppointments.

To that end the form and each of DOW and WG beans have the following
general construct (in a garish form of C++ template syntax).
public  get(int index) {
  while (index >= .size()) {
  .add(new ());
  }

  return ().get(index);   
}

And of course the appropriate

public List get(){ return ;} and Public void set( List
 ) { this. = ;}


The above JSP leads to this html fragment.










  
  . . . Blah blah blah

-
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

2004-11-19 Thread Niall Pemberton
Anyone can update the wiki. Sounds like it would be good if you documented
the grief you had on that page so that others could benefit.

Niall

- Original Message - 
From: "Slattery, Tim - BLS" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Friday, November 19, 2004 2:31 PM
Subject: RE: Indexed properties


> > Could not get the wiki's example of
> >
> > public class SkillActionForm extends ActionForm {
> >   protected List skills = new ArrayList();
> >
> >   public List getSkills() {
> >   return skills;
> >   }
> >
> >   public void setSkills(List skills) {
> >   this.skills = skills;
> >   }
> >
> >   public SkillBean getSkills(int index) {
> >   // automatically grow List size
> >   while (index >= skills.size()) {
> >   skills.add(new SkillBean());
> >   }
> >   return (SkillBean)skills.get(index);
> >   }
> >   }
> >
> > However, as soon as I changed the setSkills(List) to
> > setSkills(SkillBean) and provided a non-bean collection
> > populating method (populateSkills(List)) everything seems to
> > work. Apparently Struts is/cannot examine the method
> > arguments and is confused by the naming.
>
> I just went through a lot of grief with indexed properties. The Java Beans
> spec says that accessor methods for indexed properties have the following
> signatures:
>
> public myobj[] getProperty()
> public void setProperty(myobj[] mo)
> public myobj getProperty(int i)
> public void setProperty(int I, myobj mo)
>
> The unindexed accessors must take and return an array, no other kind of
> collection will do.
>
> My problem was that the BEA Weblogic server on my local computer has a JVM
> that does not enforce that rigorously, and is perfectly happy with
unindexed
> accessors that take other kinds of collections. But once I've got my app
> working on my own machine, I deploy it to a larger machine that's
available
> to the testers and users. And that machine's JVM will not recognize an
> indexed property if the unindexed accessors use anything other than an
> array. I was using an ArrayList, and that caused the server to tell me
that
> the property did not exist!
>
> --
> Tim Slattery
> [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

2004-11-19 Thread Slattery, Tim - BLS
> Could not get the wiki's example of
> 
> public class SkillActionForm extends ActionForm {
>   protected List skills = new ArrayList();
> 
>   public List getSkills() {
>   return skills;
>   }
> 
>   public void setSkills(List skills) {
>   this.skills = skills;
>   }
> 
>   public SkillBean getSkills(int index) {
>   // automatically grow List size
>   while (index >= skills.size()) {
>   skills.add(new SkillBean());
>   }
>   return (SkillBean)skills.get(index);
>   }
>   } 
> 
> However, as soon as I changed the setSkills(List) to
> setSkills(SkillBean) and provided a non-bean collection 
> populating method (populateSkills(List)) everything seems to 
> work. Apparently Struts is/cannot examine the method 
> arguments and is confused by the naming.

I just went through a lot of grief with indexed properties. The Java Beans
spec says that accessor methods for indexed properties have the following
signatures:

public myobj[] getProperty()
public void setProperty(myobj[] mo)
public myobj getProperty(int i)
public void setProperty(int I, myobj mo)

The unindexed accessors must take and return an array, no other kind of
collection will do.

My problem was that the BEA Weblogic server on my local computer has a JVM
that does not enforce that rigorously, and is perfectly happy with unindexed
accessors that take other kinds of collections. But once I've got my app
working on my own machine, I deploy it to a larger machine that's available
to the testers and users. And that machine's JVM will not recognize an
indexed property if the unindexed accessors use anything other than an
array. I was using an ArrayList, and that caused the server to tell me that
the property did not exist!

--
Tim Slattery
[EMAIL PROTECTED]


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



RE: Indexed properties

2004-11-19 Thread David McReynolds
Could not get the wiki's example of

public class SkillActionForm extends ActionForm {
  protected List skills = new ArrayList();

  public List getSkills() {
  return skills;
  }

  public void setSkills(List skills) {
  this.skills = skills;
  }

  public SkillBean getSkills(int index) {
  // automatically grow List size
  while (index >= skills.size()) {
  skills.add(new SkillBean());
  }
  return (SkillBean)skills.get(index);
  }
  } 

However, as soon as I changed the setSkills(List) to
setSkills(SkillBean) and provided a non-bean collection populating
method (populateSkills(List)) everything seems to work. Apparently
Struts is/cannot examine the method arguments and is confused by the
naming.



-Original Message-
From: David McReynolds [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 17, 2004 4:46 PM
To: [EMAIL PROTECTED]
Subject: Indexed properties

I am getting the nested beans out of my form ok but saving gives no joy.
I am trying to use the "2.1 Hand Cranking lazy List in the ActionForm"
from http://wiki.apache.org/struts/StrutsCatalogLazyList. However, I
never see my log messages from the indexed getter methods for any of the
nested beans.



  

  

  

  


The form has a collection of DayOfWeekBeans called days.
Each DOW bean has a collection of WorkgroupBeans called workgroups.
Each WG bean has a collection of EmployeeAppointmentBeans called
employeeAppointments.

To that end the form and each of DOW and WG beans have the following
general construct (in a garish form of C++ template syntax).
public  get(int index) {
  while (index >= .size()) {
  .add(new ());
  }

  return ().get(index);   
}

And of course the appropriate

public List get(){ return ;} and Public void set( List
 ) { this. = ;}


The above JSP leads to this html fragment.










  
  . . . Blah blah blah

-
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, checkbox

2004-11-11 Thread Rafael Cardoso
I might be missunderstood your idea, but here you start navigate with JSP and then go to 
the Action "/DisplayNestedPropertiesAction.do". You can set your checkbox in 
two ways:
if you need to set up all checkboxes to false (or true, or fixed values) on the initialization of the ActionForm, you should use the reset() method of the actionForm.
if you need to set up checkboxes with other "non-fixed" values, you will need to create one action before to set up the ActionForm. In that Action you should instantiate your actionForm, and then populate your property of the checkboxes and then you ActionFoward to the JSP. 

I Hope it helps...
[]´s
Rafael Cardoso


Ryan julius wrote:
Hi, 

I have investigated the indexed properties as follows.
structure of my jsp page:
===

 



"> 






 



ActionForm:
=
public class NestedPropertiesForm extends FWKActionForm{
/**
* 

*/
public NestedPropertiesForm() {
super();
}

/**
* Permet de récupérer la collection "skills" des objets skillBean
*/
protected List skills = new ArrayList();
/**
* Permet de récupérer la collection "skills" des objets skillBean
*/
public List getSkills() {
return skills;
}
public void setSkills(List skills) {
this.skills = skills;
}

/**
* Permet de récupérer dans l'action, l'objet indicé "index" de la liste. 

* @param index
* @return
*/
public SkillBean getSkills(int index) {
// automatically grow List size
while (index >= skills.size()) {
skills.add(new SkillBean());
}
return (SkillBean)skills.get(index);
}

public void reset(ActionMapping actionMapping, HttpServletRequest 
httpServletRequest) {
//I would like to initialize the checkbox properties here to false...
}

public void init(){
skills = new ArrayList();
}
}
embeded Bean:
**
public class SkillBean {

private boolean checkbox;
private String qualification;
private String profession;

/**
* 

*/
public SkillBean() {
super();
// TODO Raccord de constructeur auto-généré
}
/**
* 

*/
public SkillBean(boolean checkBox, String qualif, String profession) {
super();
// TODO Raccord de constructeur auto-généré
this.checkbox = checkBox;
this.qualification = qualif;
this.profession = profession;
}
/**
* @return
*/
public boolean getCheckbox() {
return checkbox;
}
/**
* @return
*/
public String getProfession() {
return profession;
}
/**
* @return
*/
public String getQualification() {
return qualification;
}
/**
* @param string
*/
public void setCheckBox(boolean checkBox) {
this.checkbox = checkBox;
}
/**
* @param string
*/
public void setQualification(String string) {
qualification = string;
}
/**
* @param string
*/
public void setProfession(String string) {
profession = string;
}
}
Action:
=
public class NestedPropertiesAction extends Action{
public ActionForward execute(ActionMapping arg0, 

ActionForm arg1, 

HttpServletRequest arg2, 

HttpServletResponse arg3) throws Exception {
NestedPropertiesForm nestedPropertiesForm = (NestedPropertiesForm)arg1; 

List skillBeanList = createSkillList();
nestedPropertiesForm.setSkills(skillBeanList);
return arg0.findForward("nestedPropertiesPage");
}
}
public static List createSkillList(){
List skillBeanList = new ArrayList();
SkillBean skillBean1 = new SkillBean(false, "Engineer", "Developer");
SkillBean skillBean2 = new SkillBean(true, "practician", "surg");
SkillBean skillBean3 = new SkillBean(false, "Architect", "Maintenance 
Appareil");
skillBeanList.add(skillBean1);
skillBeanList.add(skillBean2);
skillBeanList.add(skillBean3);
return skillBeanList;
}
My questions:
==
Please:
=
1.)Am I missing something in this implementation?
2.) Knowing that the right way of correctly using a checkbox is to initialize 

the checkbox property in the reset method; how can I do this in my actionForm
with the indexProperties?
3.) How can I get only the checked Bean in my action. 

When I select a checkbox, I would like to trigger an action (/ViewTheSkill.do). 
How can I get (ONLY) the corresponding bean in my action? 
ViewTheSkill.execute(). I would like to use this bean for further processing.
public class ViewTheSkillAction extends Action{
public ActionForward execute(ActionMapping arg0, 

ActionForm arg1, 

HttpServletRequest arg2, 

HttpServletResponse arg3) throws Exception {
NestedPropertiesForm nestedPropertiesForm = (NestedPropertiesForm)arg1; 

//HOW CAN I get the checked SkillBean here?
}
}
Thanks very much.

-
Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Créez votre Yahoo! Mail
Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis.Téléchargez GRATUITEMENT ici !
 


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


Re: Indexed Properties and Lazy List behaviour

2004-10-02 Thread Hubert Rabago
Cool.  I get it.  Wow.  Now that I get it, I really like it.  It's
like the dyna form bean finally caught up with the nested tags!

Thanks, Niall.

On Sat, 2 Oct 2004 00:50:14 +0100, Niall Pemberton
<[EMAIL PROTECTED]> wrote:
> OK I think I must be spreading confusion - thats what you get, arrays of
> beans, not strings.
> 
> For LazyValidatorForm the default for an indexed property is an ArrayList of
> LazyDynaBean - and it populates the LazyDynaBean for you automatically.
> 
> For LazyDynaBean the default indexed property is an ArrayList - but it
> doesn't populate it with anything. If however you create a custom
> LazyDynaBean (like the example I gave) changing the default indexed property
> to an LazyDynaBean array then the default indexed property is an Array of
> LazyDynaBean  - populated automatically. Now you can have 1...n levels of
> indexed beans to your hearts content.
> 
> Niall
> 
> - Original Message -
> From: "Hubert Rabago" <[EMAIL PROTECTED]>
> Subject: Re: Indexed Properties and Lazy List behaviour
> 
> > My understanding of the question on the user list was for a form which
> > contained an array of beans, instead of just an array of strings.  An
> > example would be a form bean containing a list/array of children, each
> > with a name, date of birth, daily allowance, etc.  If each child is a
> > dyna form, I can use FormDef for each element.
>

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



Re: Indexed Properties and Lazy List behaviour

2004-10-01 Thread Niall Pemberton
OK I think I must be spreading confusion - thats what you get, arrays of
beans, not strings.

For LazyValidatorForm the default for an indexed property is an ArrayList of
LazyDynaBean - and it populates the LazyDynaBean for you automatically.

For LazyDynaBean the default indexed property is an ArrayList - but it
doesn't populate it with anything. If however you create a custom
LazyDynaBean (like the example I gave) changing the default indexed property
to an LazyDynaBean array then the default indexed property is an Array of
LazyDynaBean  - populated automatically. Now you can have 1...n levels of
indexed beans to your hearts content.

Niall

- Original Message - 
From: "Hubert Rabago" <[EMAIL PROTECTED]>
Subject: Re: Indexed Properties and Lazy List behaviour

> My understanding of the question on the user list was for a form which
> contained an array of beans, instead of just an array of strings.  An
> example would be a form bean containing a list/array of children, each
> with a name, date of birth, daily allowance, etc.  If each child is a
> dyna form, I can use FormDef for each element.



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



Re: Indexed Properties and Lazy List behaviour

2004-10-01 Thread Hubert Rabago
Aside from form field definition, which isn't needed for a lazy form
bean, having a FormDef-backed form would take care of the
formatting/parsing of the data, even i18n.  The form definition &
validation config combo is actually just optional.

My understanding of the question on the user list was for a form which
contained an array of beans, instead of just an array of strings.  An
example would be a form bean containing a list/array of children, each
with a name, date of birth, daily allowance, etc.  If each child is a
dyna form, I can use FormDef for each element.

On Fri, 1 Oct 2004 22:35:15 +0100, Niall Pemberton
<[EMAIL PROTECTED]> wrote:
> I believe I understand the principle of FormDef - you're combining the form
> definition with the validation rules. So is that why you want to nest
> indexed ActionForms rather than any old type of DynaBean? Are you then
> calling the validate() method on each of the indexed ActionForms?
> 
> You're right if you want a properly initialized lazy ActionForm then you
> need to go through the FormBeanConfig's createActionForm method. Having said
> that the default "indexed" property type of LazyDynaBean/LazyValdatorForm is
> an ArrayList - changing that to a LazyDynaBean[] as I showed in the
> CustomLazyBean means there is no need to then initialize that indexed
> property - its done automatically for arrays (CustomLazyBean would
> instantiate a new DynaBean and grows it accordingly).
> 
> From reading the message on the FormDef user list, then just having a
> property which is a CustomLazyBean (rather than CustomLazyBean array) sounds
> like it would work for your user - then only thing then is I don't really
> understand how that then interacts with FormDef - hence my questions at the
> top.
> 
> Sorry, should have got round to giving FormDef a go - but lifes busy :-(
> 
> Niall
> 
> 
> 
> - Original Message -
> From: "Hubert Rabago" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, October 01, 2004 9:43 PM
> Subject: Re: Indexed Properties and Lazy List behaviour
> 
> > But if I need it to be a DynaActionForm subclass, then I'd just use
> > LazyValidatorForm or its subclass, right?  In which case, wouldn't I
> > have to worry about it being properly initialized, as indicated in
> >
> http://struts.apache.org/userGuide/building_controller.html#dyna_action_form_classes
> > ?
> >
> > Someone asked about combining FormDef and LazyBeans to come up with a
> > form containing indexed properties.  FormDef works with
> > DynaActionForms.  If I have an array or list of dyna forms, I can use
> > FormDef with each element.  The problem is coming up with a lazy,
> > non-session-scope implementation.  I came up with the code snippet at
> > https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=12
> > because I assumed that in order to create a proper ActionForm, it
> > needed to go through FormBeanConfig's createActionForm.  Are lazy dyna
> > forms exempt from this requirement?
> >
> >
> > On Fri, 1 Oct 2004 21:14:25 +0100, Niall Pemberton
> > <[EMAIL PROTECTED]> wrote:
> > > It could, although there is no need for it to be an ActionForm - could
> just
> > > be a LazyDynaBean. Having said that, you would probably want to override
> the
> > > default "indexed" type to be a LazyDynaBean array rather than ArrayList
> as
> > > LazyDynaBean doesn't populate Lists, but it does Arrays.
> > >
> > > public class CustomLazyBean extends LazyDynaBean {
> > >
> > >public CustomLazyBean() {
> > > super();
> > >}
> > >
> > >   protected Object defaultIndexedProperty(String name) {
> > >        return new CustomLazyBean[0];
> > >}
> > >
> > > }
> > >
> > >  > > type="org.apache.struts.validator.LazyValidatorForm>
> > >  > > type="myPackage.CustomLazyBean[]"/>
> > > 
> > >
> > >
> > > Niall
> > >
> > >
> > >
> > > - Original Message -
> > > From: "Hubert Rabago" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Friday, October 01, 2004 8:07 PM
> > > Subject: Re: Indexed Properties and Lazy List behaviour
> > >
> > > > In 2.3 of StrutsCatalogLazyList, it uses a Lazy*Form flavor to hold an
> > > > indexed property.  Can the indexed property itself an array or list of
> > > > Lazy*Form objects?
> > > >
> > > >  > > > type="org.apache.struts.validator.LazyValidatorForm>
> > > >  > > > type="org.apache.struts.validator.LazyValidatorForm"/>
> > > > 
> > > >

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



Re: Indexed Properties and Lazy List behaviour

2004-10-01 Thread Niall Pemberton
I believe I understand the principle of FormDef - you're combining the form
definition with the validation rules. So is that why you want to nest
indexed ActionForms rather than any old type of DynaBean? Are you then
calling the validate() method on each of the indexed ActionForms?

You're right if you want a properly initialized lazy ActionForm then you
need to go through the FormBeanConfig's createActionForm method. Having said
that the default "indexed" property type of LazyDynaBean/LazyValdatorForm is
an ArrayList - changing that to a LazyDynaBean[] as I showed in the
CustomLazyBean means there is no need to then initialize that indexed
property - its done automatically for arrays (CustomLazyBean would
instantiate a new DynaBean and grows it accordingly).

>From reading the message on the FormDef user list, then just having a
property which is a CustomLazyBean (rather than CustomLazyBean array) sounds
like it would work for your user - then only thing then is I don't really
understand how that then interacts with FormDef - hence my questions at the
top.

Sorry, should have got round to giving FormDef a go - but lifes busy :-(

Niall

- Original Message - 
From: "Hubert Rabago" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, October 01, 2004 9:43 PM
Subject: Re: Indexed Properties and Lazy List behaviour


> But if I need it to be a DynaActionForm subclass, then I'd just use
> LazyValidatorForm or its subclass, right?  In which case, wouldn't I
> have to worry about it being properly initialized, as indicated in
>
http://struts.apache.org/userGuide/building_controller.html#dyna_action_form_classes
> ?
>
> Someone asked about combining FormDef and LazyBeans to come up with a
> form containing indexed properties.  FormDef works with
> DynaActionForms.  If I have an array or list of dyna forms, I can use
> FormDef with each element.  The problem is coming up with a lazy,
> non-session-scope implementation.  I came up with the code snippet at
> https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=12
> because I assumed that in order to create a proper ActionForm, it
> needed to go through FormBeanConfig's createActionForm.  Are lazy dyna
> forms exempt from this requirement?
>
>
> On Fri, 1 Oct 2004 21:14:25 +0100, Niall Pemberton
> <[EMAIL PROTECTED]> wrote:
> > It could, although there is no need for it to be an ActionForm - could
just
> > be a LazyDynaBean. Having said that, you would probably want to override
the
> > default "indexed" type to be a LazyDynaBean array rather than ArrayList
as
> > LazyDynaBean doesn't populate Lists, but it does Arrays.
> >
> > public class CustomLazyBean extends LazyDynaBean {
> >
> >public CustomLazyBean() {
> > super();
> >}
> >
> >   protected Object defaultIndexedProperty(String name) {
> >return new CustomLazyBean[0];
> >}
> >
> > }
> >
> >  > type="org.apache.struts.validator.LazyValidatorForm>
> >      >     type="myPackage.CustomLazyBean[]"/>
> > 
> >
> >
> > Niall
> >
> >
> >
> > - Original Message -
> > From: "Hubert Rabago" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, October 01, 2004 8:07 PM
> > Subject: Re: Indexed Properties and Lazy List behaviour
> >
> > > In 2.3 of StrutsCatalogLazyList, it uses a Lazy*Form flavor to hold an
> > > indexed property.  Can the indexed property itself an array or list of
> > > Lazy*Form objects?
> > >
> > >  > > type="org.apache.struts.validator.LazyValidatorForm>
> > >  > > type="org.apache.struts.validator.LazyValidatorForm"/>
> > > 
> > >
> > >
> > > On Fri, 1 Oct 2004 00:17:40 +0100, Niall Pemberton
> > > <[EMAIL PROTECTED]> wrote:
> > > > I've set up this wiki page showing how to use indexed properties and
> > > > implement lazy list behaviour in an ActionForm.
> > > >
> > > > http://wiki.apache.org/struts/StrutsCatalogLazyList
> > > >
> > > > There are three possible solutions to lazy list beviour on that
page -
> > but
> > > > since I'm only using LazyDynaBeans myself, I would appreciate if
anyone
> > > > using either the Commons Collections LazyList or hand cranked lazy
lists
> > > > would take a look to see if what I posted looks right.
> > > >
> > > > 

Re: Indexed Properties and Lazy List behaviour

2004-10-01 Thread Hubert Rabago
But if I need it to be a DynaActionForm subclass, then I'd just use
LazyValidatorForm or its subclass, right?  In which case, wouldn't I
have to worry about it being properly initialized, as indicated in
http://struts.apache.org/userGuide/building_controller.html#dyna_action_form_classes
?

Someone asked about combining FormDef and LazyBeans to come up with a
form containing indexed properties.  FormDef works with
DynaActionForms.  If I have an array or list of dyna forms, I can use
FormDef with each element.  The problem is coming up with a lazy,
non-session-scope implementation.  I came up with the code snippet at
https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=12
because I assumed that in order to create a proper ActionForm, it
needed to go through FormBeanConfig's createActionForm.  Are lazy dyna
forms exempt from this requirement?


On Fri, 1 Oct 2004 21:14:25 +0100, Niall Pemberton
<[EMAIL PROTECTED]> wrote:
> It could, although there is no need for it to be an ActionForm - could just
> be a LazyDynaBean. Having said that, you would probably want to override the
> default "indexed" type to be a LazyDynaBean array rather than ArrayList as
> LazyDynaBean doesn't populate Lists, but it does Arrays.
> 
> public class CustomLazyBean extends LazyDynaBean {
> 
>public CustomLazyBean() {
> super();
>}
> 
>   protected Object defaultIndexedProperty(String name) {
>return new CustomLazyBean[0];
>}
> 
> }
> 
>  type="org.apache.struts.validator.LazyValidatorForm>
>  type="myPackage.CustomLazyBean[]"/>
> 
> 
> 
> Niall
> 
> 
> 
> - Original Message -
> From: "Hubert Rabago" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, October 01, 2004 8:07 PM
> Subject: Re: Indexed Properties and Lazy List behaviour
> 
> > In 2.3 of StrutsCatalogLazyList, it uses a Lazy*Form flavor to hold an
> > indexed property.  Can the indexed property itself an array or list of
> > Lazy*Form objects?
> >
> >  > type="org.apache.struts.validator.LazyValidatorForm>
> >  > type="org.apache.struts.validator.LazyValidatorForm"/>
> > 
> >
> >
> > On Fri, 1 Oct 2004 00:17:40 +0100, Niall Pemberton
> > <[EMAIL PROTECTED]> wrote:
> > > I've set up this wiki page showing how to use indexed properties and
> > > implement lazy list behaviour in an ActionForm.
> > >
> > > http://wiki.apache.org/struts/StrutsCatalogLazyList
> > >
> > > There are three possible solutions to lazy list beviour on that page -
> but
> > > since I'm only using LazyDynaBeans myself, I would appreciate if anyone
> > > using either the Commons Collections LazyList or hand cranked lazy lists
> > > would take a look to see if what I posted looks right.
> > >
> > > Niall
> > >
> > > -
> > > 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 and Lazy List behaviour

2004-10-01 Thread Niall Pemberton
It could, although there is no need for it to be an ActionForm - could just
be a LazyDynaBean. Having said that, you would probably want to override the
default "indexed" type to be a LazyDynaBean array rather than ArrayList as
LazyDynaBean doesn't populate Lists, but it does Arrays.

public class CustomLazyBean extends LazyDynaBean {

public CustomLazyBean() {
 super();
}

   protected Object defaultIndexedProperty(String name) {
return new CustomLazyBean[0];
}

}


 
 


Niall

- Original Message - 
From: "Hubert Rabago" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, October 01, 2004 8:07 PM
Subject: Re: Indexed Properties and Lazy List behaviour


> In 2.3 of StrutsCatalogLazyList, it uses a Lazy*Form flavor to hold an
> indexed property.  Can the indexed property itself an array or list of
> Lazy*Form objects?
>
>  type="org.apache.struts.validator.LazyValidatorForm>
>  type="org.apache.struts.validator.LazyValidatorForm"/>
> 
>
>
> On Fri, 1 Oct 2004 00:17:40 +0100, Niall Pemberton
> <[EMAIL PROTECTED]> wrote:
> > I've set up this wiki page showing how to use indexed properties and
> > implement lazy list behaviour in an ActionForm.
> >
> > http://wiki.apache.org/struts/StrutsCatalogLazyList
> >
> > There are three possible solutions to lazy list beviour on that page -
but
> > since I'm only using LazyDynaBeans myself, I would appreciate if anyone
> > using either the Commons Collections LazyList or hand cranked lazy lists
> > would take a look to see if what I posted looks right.
> >
> > Niall
> >
> > -
> > 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 and Lazy List behaviour

2004-10-01 Thread Hubert Rabago
In 2.3 of StrutsCatalogLazyList, it uses a Lazy*Form flavor to hold an
indexed property.  Can the indexed property itself an array or list of
Lazy*Form objects?





On Fri, 1 Oct 2004 00:17:40 +0100, Niall Pemberton
<[EMAIL PROTECTED]> wrote:
> I've set up this wiki page showing how to use indexed properties and
> implement lazy list behaviour in an ActionForm.
> 
> http://wiki.apache.org/struts/StrutsCatalogLazyList
> 
> There are three possible solutions to lazy list beviour on that page - but
> since I'm only using LazyDynaBeans myself, I would appreciate if anyone
> using either the Commons Collections LazyList or hand cranked lazy lists
> would take a look to see if what I posted looks right.
> 
> Niall
> 
> -
> 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 and Lazy List behaviour

2004-10-01 Thread David Suarez
Your other solutions are awesome.  I use the "hand crank..." one since I
didn't know of the lazylist at the time.  The code looks right.

Thanks for posting the other "lazy" solutions, I'll try them in the
future.

Regards...djsuarez

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 30, 2004 6:18 PM
To: Struts Users Mailing List
Subject: Indexed Properties and Lazy List behaviour

I've set up this wiki page showing how to use indexed properties and
implement lazy list behaviour in an ActionForm.

http://wiki.apache.org/struts/StrutsCatalogLazyList

There are three possible solutions to lazy list beviour on that page -
but
since I'm only using LazyDynaBeans myself, I would appreciate if anyone
using either the Commons Collections LazyList or hand cranked lazy lists
would take a look to see if what I posted looks right.

Niall






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



Re: indexed properties

2004-08-27 Thread Michael McGrady
The best thing to do, in my humble opinion, is to chase the code down 
back through to commons beanutils and like classes in Struts.  Then you 
will see what is not documented and will know how you can change things 
if you want or extend and change things if you want more in a tag.

Michael
Lynn Stevens wrote:
OK,  I am new to struts...so if someone could help it would be great! 


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


RE: Indexed properties and DynaActionForm

2004-08-16 Thread Jaakko Rytinki


-Original Message-
From: Jim Barrows [mailto:[EMAIL PROTECTED] 
Sent: 12. elokuuta 2004 18:48
To: Struts Users Mailing List
Subject: RE: Indexed properties and DynaActionForm



> -Original Message-
> From: Jaakko Rytinki [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 12, 2004 3:05 AM
> To: 'Struts Users Mailing List'
> Subject: Indexed properties and DynaActionForm
> 
> 
> Could someone explain why the following does not work:
> 
> - - - - Form bean:
>  type="org.apache.struts.validator.DynaActionForm">
> 
> 
> 

Small typo there, I tried to use ArrayList instead of List.


> - - - - Action Mapping:
>type="test.populateFormAction" 
>   scope="request">
>   
> 

If you are populating here, and do not have the form specified, then how
is the form getting sent to the page?
I typically set the name parameter, and validate=false when going
through my populate actions.

- - 

By using HttpServletRequest.setAttribute("myStringList",
dataObjectArray); name-attribute, as far as I know, defines the form
where we want to read the data, it's not necessary in actions where you
just throw some stuff to request.


> 
>type="test.editFormAction" 
>   scope="request"
>   name="forms.myForm"
>   
> 
> 
> - - - - Prepopulated form:
> 
>   
> 
> 
> - - - - Action:
> DynaActionForm dynaForm = (DynaActionForm) myForm;
> List myList = (List) dynaForm.get("values");
> 
> The form shows up fine, but somehow the List I retrieve 
> doesn't contain
> any elements. ( If the text field is empty, List should still 
> contain at
> least one element )
> 
> Only workaround I've found so far is to set size-parameter to 
> form-bean
> definition ( and because the form can contain 0 to n items, it is kind
> of a nasty way to do it, setting the size parameter high 
> enough so that
> overflow wont happen )
> 
> So.. how to use DynaActionForm to retrieve indexed properties from
> dynamically created form?
> 
> 
> 
> 
> -
> 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 and DynaActionForm

2004-08-12 Thread Jim Barrows


> -Original Message-
> From: Jaakko Rytinki [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 12, 2004 3:05 AM
> To: 'Struts Users Mailing List'
> Subject: Indexed properties and DynaActionForm
> 
> 
> Could someone explain why the following does not work:
> 
> - - - - Form bean:
>  type="org.apache.struts.validator.DynaActionForm">
> 
> 
> 
> - - - - Action Mapping:
>type="test.populateFormAction" 
>   scope="request">
>   
> 

If you are populating here, and do not have the form specified, then how is the form 
getting sent to the page?
I typically set the name parameter, and validate=false when going through my populate 
actions.


> 
>type="test.editFormAction" 
>   scope="request"
>   name="forms.myForm"
>   
> 
> 
> - - - - Prepopulated form:
> 
>   
> 
> 
> - - - - Action:
> DynaActionForm dynaForm = (DynaActionForm) myForm;
> List myList = (List) dynaForm.get("values");
> 
> The form shows up fine, but somehow the List I retrieve 
> doesn't contain
> any elements. ( If the text field is empty, List should still 
> contain at
> least one element )
> 
> Only workaround I've found so far is to set size-parameter to 
> form-bean
> definition ( and because the form can contain 0 to n items, it is kind
> of a nasty way to do it, setting the size parameter high 
> enough so that
> overflow wont happen )
> 
> So.. how to use DynaActionForm to retrieve indexed properties from
> dynamically created form?
> 
> 
> 
> 
> -
> 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 working formbean->htmlform, not working htmlform->formbean

2004-04-30 Thread Berke, Wayne [IT]
Scott,

That was it.  Thanks a bunch.

One thing I don't understand though.  If the setProperty for the BeanUtils
couldn't find an appropriate setter (which it couldn't until I declared
setIsf() in the form), shouldn't it have squawked about it with TRACE
level logging?

Wayne

-Original Message-
From: Glenn, Scott [mailto:[EMAIL PROTECTED]
Sent: Friday, April 30, 2004 11:10 AM
To: 'Struts Users Mailing List'
Subject: RE: Indexed properties working formbean->htmlform, not working
htmlform->formbean


I think the id attribute on the iterate tag must match the getter on the
"get row (index)" method of your form bean. For example I have:-



and my form bean is:-

private List rows = null;

public FormRow getRows (int index)
{   
return (RenamePDFFormRow)rows.get(index);
}

When the form is submitted, the getRows(int) method is called to retrieve
the relevant entry in the collection, which is then reflected to set the
individual properties.

So try adding this to your form:-

public FundamentalsInfo getIsf (int index)
{
return fundInfo.get(index);
}

Hope that helps, 

Scott.

> -Original Message-
> From: Berke, Wayne [IT] [mailto:[EMAIL PROTECTED]
> Sent: 30 April 2004 15:50
> To: Struts Users Mailing List
> Subject: Indexed properties working formbean->htmlform, not working
> htmlform->formbean
> 
> I've been tearing my hair out trying to get indexed properties
> to work.  Apparently, there is some correspondence between the HTML
> fields and the ActionForm indexed properties because when the ActionForm
> is initialized, it does correctly populate the default HTML form fields.
> However, when I modify an HTML field that corresponds to an indexed
> property and submit the form, that change does not get reflected in
> the ActionForm.
> 
> I tried turning on log4j trace in BeanUtils and PropertyUtils and it seems
> like the correct setProperty calls are being made, but printing out the
> ActionForm fields shows no change from the defaults.
> 
> Any information, including suggestions for how to further debug this
> would be greatly appreciated.
> 
> My JSP looks like this:
> 
>  class="bglt3">
>   
>indexId="ix">
>   
>   NM: 
>  property="colName" indexed="true" size="10"
> styleClass="t11" />
>     
>   DISP: 
>  property="displayName" indexed="true"
size="10"
> styleClass="t11" />
>     
>   
>   
>   
>   
>   
> 
> 
> The ActionForm is:
> 
> public class ISF extends ActionForm {
> 
>   private List fundInfo = new ArrayList();
>   {
>   System.out.println("INITIALIZING!");
>   fundInfo.add(new FundamentalsInfo("ONE", "1"));
>   fundInfo.add(new FundamentalsInfo("TWO", "2"));
>   fundInfo.add(new FundamentalsInfo("THREE", "3"));
>   }
>   public List getFundInfo() {
>   return fundInfo;
>   }
>   public void setFundInfo(List fi) {
>   fundInfo = fi;
>   }
>   public FundamentalsInfo getFundInfo(int index) {
>   return (FundamentalsInfo) fundInfo.get(index);
>   }
>   public void setFundInfo(int index, FundamentalsInfo fi) {
>   fundInfo.set(index, fi);
>   }
> 
>   public void reset(ActionMapping mapping, HttpServletRequest request)
> {
>   }
> }
> 
> A FundamentalsInfo object is just a simple bean with two attributes,
> colName and
> displayName.
> 
> The associated Action simply prints out the contents of the fundInfo list
> and it
> shows that the fields never change from the values they were initialized
> with.
> 
> Wayne
> 
> -
> 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 working formbean->htmlform, not working ht mlform->formbean

2004-04-30 Thread Glenn, Scott
I think the id attribute on the iterate tag must match the getter on the
"get row (index)" method of your form bean. For example I have:-



and my form bean is:-

private List rows = null;

public FormRow getRows (int index)
{   
return (RenamePDFFormRow)rows.get(index);
}

When the form is submitted, the getRows(int) method is called to retrieve
the relevant entry in the collection, which is then reflected to set the
individual properties.

So try adding this to your form:-

public FundamentalsInfo getIsf (int index)
{
return fundInfo.get(index);
}

Hope that helps, 

Scott.

> -Original Message-
> From: Berke, Wayne [IT] [mailto:[EMAIL PROTECTED]
> Sent: 30 April 2004 15:50
> To: Struts Users Mailing List
> Subject: Indexed properties working formbean->htmlform, not working
> htmlform->formbean
> 
> I've been tearing my hair out trying to get indexed properties
> to work.  Apparently, there is some correspondence between the HTML
> fields and the ActionForm indexed properties because when the ActionForm
> is initialized, it does correctly populate the default HTML form fields.
> However, when I modify an HTML field that corresponds to an indexed
> property and submit the form, that change does not get reflected in
> the ActionForm.
> 
> I tried turning on log4j trace in BeanUtils and PropertyUtils and it seems
> like the correct setProperty calls are being made, but printing out the
> ActionForm fields shows no change from the defaults.
> 
> Any information, including suggestions for how to further debug this
> would be greatly appreciated.
> 
> My JSP looks like this:
> 
>  class="bglt3">
>   
>indexId="ix">
>   
>   NM: 
>  property="colName" indexed="true" size="10"
> styleClass="t11" />
>     
>   DISP: 
>  property="displayName" indexed="true"
size="10"
> styleClass="t11" />
>     
>   
>   
>   
>   
>   
> 
> 
> The ActionForm is:
> 
> public class ISF extends ActionForm {
> 
>   private List fundInfo = new ArrayList();
>   {
>   System.out.println("INITIALIZING!");
>   fundInfo.add(new FundamentalsInfo("ONE", "1"));
>   fundInfo.add(new FundamentalsInfo("TWO", "2"));
>   fundInfo.add(new FundamentalsInfo("THREE", "3"));
>   }
>   public List getFundInfo() {
>   return fundInfo;
>   }
>   public void setFundInfo(List fi) {
>   fundInfo = fi;
>   }
>   public FundamentalsInfo getFundInfo(int index) {
>   return (FundamentalsInfo) fundInfo.get(index);
>   }
>   public void setFundInfo(int index, FundamentalsInfo fi) {
>   fundInfo.set(index, fi);
>   }
> 
>   public void reset(ActionMapping mapping, HttpServletRequest request)
> {
>   }
> }
> 
> A FundamentalsInfo object is just a simple bean with two attributes,
> colName and
> displayName.
> 
> The associated Action simply prints out the contents of the fundInfo list
> and it
> shows that the fields never change from the values they were initialized
> with.
> 
> Wayne
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


RE: Indexed Properties DynaValidatorForm

2004-04-20 Thread Takhar, Sandeep
I don't think this is there.  Not sure about the nightly builds.

sandeep

-Original Message-
From: Amin Lalji [mailto:[EMAIL PROTECTED]
Sent: Monday, April 19, 2004 5:16 PM
To: 'Struts Users Mailing List'
Subject: Indexed Properties DynaValidatorForm


I am trying to use a DynaValidatorForm with Indexed Properties...
I have setup validation using the Validator Framework...

Validation is working, however when it comes time to display failed
validation (from ActionErrors), I can not seem to output an individual error
message for each indexed property... instead validation errors for a single
member of the indexed properties are displayed for all of the members ... 

Is there any way to display the error solely for the Indexed Property in
question?

Thanks,

Amin


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