RE: Long Story short

2001-07-19 Thread Torsten Terp

Hi 

Dave, let me tell you this, if you are ever in
my neighborhood beers on me :-)

Finally i got it working, what i didnt realise
was that i had to split up the action in the
show and save parts, like you do in your code!

... so little hair left, for such a small mistake :-)

This is great, thanks a lot!!

^terp

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 9:05 PM
To: [EMAIL PROTECTED]
Subject: Re: Long Story short




Torsten,

Hi.  Please find attached some of my code, as requested in your mail to me
directly (was not a problem!).  Here's what I do:

I basically call ShowParameters to get the underlying parameters, and fill the
form, which is in Session  scope.  User is then presented with parameters.jsp
(note, this is fairly complicated, but you should be able to follow it through).

When they submit the page, SaveParameters is called, and the updated parameters
in the Vector are processed.

Would recommend you try sticking the form in session scope, if you are
prefilling it in another action.

Let me know if I can help further.

Cheers,

Dave

(See attached file: indexedexample.zip)



"Torsten Terp" <[EMAIL PROTECTED]> on 07/19/2001 05:01:38
AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: Long Story short



Hi,

Although i have followed the example below i still have the problem with saving
the indexed fields. It is driving me nuts so if anybody who have it working
would
take the time to see if they can spot the error i will be very very greatfull.

The source below is with a vector instead of an array. What happens is that when
the action code is executed the vector in the form is empy although the simple
String
element is saved alright!

My form looks like this:

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

  private Vector parameterList = new Vector();
  private String tester;

   // --- Properties

  public String getTester() { return tester; }

  public void setTester(String  v) { this.tester = v; }

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

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

  public Parameter getParameter(int index){ return
(Parameter)parameterList.elementAt(index); }
}

The Parameter class used for each row:

public class Parameter {

  String key;
  String desc;
  String value;

  public String getKey() {return key;}
  public void setKey(String  v) {this.key = v;}

  public String getDesc() {return desc;}
  public void setDesc(String  v) {this.desc = v;}

  public String getValue() {return value;}
  public void setValue(String  v) {this.value = v;}
}

The action looks like this:

public final class SaveParametersAction extends Action {

// - Public Methods

public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException {

ParametersForm paramForm = (ParametersForm) form;

// Get the simple tester
String test = paramForm.getTester();
System.out.println("paramForm tester was = '"+ test + "'");

// Get the parameter list
Vector paramList = paramForm.getParameterList();
Parameter parm1 = new Parameter();
parm1 = (Parameter)paramList.elementAt(0);
System.out.println("parm1.getValue():"+parm1.getValue());

// Forward control to the specified success URI
return (mapping.findForward("success"));
  }
}

My JSP looks like this:


<%
   //cheating to get the objects in the request...

   ParametersForm parametersForm =  new ParametersForm();

   Vector parametersList = new Vector();

   Parameter parameter1 = new Parameter();
   Parameter parameter2 = new Parameter();

   parameter1.setKey("key0");
   parameter1.setDesc("desc0");
   parameter1.setValue("value0");
   parameter2.setKey("key1");
   parameter2.setDesc("desc1");
   parameter2.setValue("value1");

   parametersList.addElement(parameter1);
   parametersList.addElement(parameter2);

   parametersForm.setParameterList(parametersList);
   par

Re: Long Story short

2001-07-19 Thread dhay



Torsten,

Hi.  Please find attached some of my code, as requested in your mail to me
directly (was not a problem!).  Here's what I do:

I basically call ShowParameters to get the underlying parameters, and fill the
form, which is in Session  scope.  User is then presented with parameters.jsp
(note, this is fairly complicated, but you should be able to follow it through).

When they submit the page, SaveParameters is called, and the updated parameters
in the Vector are processed.

Would recommend you try sticking the form in session scope, if you are
prefilling it in another action.

Let me know if I can help further.

Cheers,

Dave

(See attached file: indexedexample.zip)



"Torsten Terp" <[EMAIL PROTECTED]> on 07/19/2001 05:01:38
AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: Long Story short



Hi,

Although i have followed the example below i still have the problem with saving
the indexed fields. It is driving me nuts so if anybody who have it working
would
take the time to see if they can spot the error i will be very very greatfull.

The source below is with a vector instead of an array. What happens is that when
the action code is executed the vector in the form is empy although the simple
String
element is saved alright!

My form looks like this:

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

  private Vector parameterList = new Vector();
  private String tester;

   // --- Properties

  public String getTester() { return tester; }

  public void setTester(String  v) { this.tester = v; }

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

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

  public Parameter getParameter(int index){ return
(Parameter)parameterList.elementAt(index); }
}

The Parameter class used for each row:

public class Parameter {

  String key;
  String desc;
  String value;

  public String getKey() {return key;}
  public void setKey(String  v) {this.key = v;}

  public String getDesc() {return desc;}
  public void setDesc(String  v) {this.desc = v;}

  public String getValue() {return value;}
  public void setValue(String  v) {this.value = v;}
}

The action looks like this:

public final class SaveParametersAction extends Action {

// - Public Methods

public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException {

ParametersForm paramForm = (ParametersForm) form;

// Get the simple tester
String test = paramForm.getTester();
System.out.println("paramForm tester was = '"+ test + "'");

// Get the parameter list
Vector paramList = paramForm.getParameterList();
Parameter parm1 = new Parameter();
parm1 = (Parameter)paramList.elementAt(0);
System.out.println("parm1.getValue():"+parm1.getValue());

// Forward control to the specified success URI
return (mapping.findForward("success"));
  }
}

My JSP looks like this:


<%
   //cheating to get the objects in the request...

   ParametersForm parametersForm =  new ParametersForm();

   Vector parametersList = new Vector();

   Parameter parameter1 = new Parameter();
   Parameter parameter2 = new Parameter();

   parameter1.setKey("key0");
   parameter1.setDesc("desc0");
   parameter1.setValue("value0");
   parameter2.setKey("key1");
   parameter2.setDesc("desc1");
   parameter2.setValue("value1");

   parametersList.addElement(parameter1);
   parametersList.addElement(parameter2);

   parametersForm.setParameterList(parametersList);
   parametersForm.setTester("Testing non-indexed");

   pageContext.setAttribute("parametersForm", parametersForm,
PageContext.REQUEST_SCOPE);
%>







 
 
  
   
   
  
  
   
  
 
 
 
  
   tester:
  
  
   
  
 

submit





And finally the struts-config.xml elements related to this:



  


  

  


  
  

  



I apologize for the long post (i dosnt quite live up to the tit

RE: Long Story short

2001-07-19 Thread Torsten Terp

Hi,

Maybe im doing something wrong with this initialisation, but the way
im using this (when i get it working) is that the table gets populated
with data from a database, and this should be editable by the user. I.e.,
i have an action, which based on a single input field, finds the data and
populates the form bean, and stores it in the request just before going
to the parameters.jsp page in the example. I was trying to simulate this 
scenario by populating the form bean with some dummy data before displying
the page. 

I just tried to do what you say, and what happens is the indexed fields
are not diplayed at all, only the simple text input field, it just isnt
initialised. Am i doing something wrong here? If i need to populate the
form prior to displaying it, can i do it in some other way?!?

Regarding the indexed tag, i dont quite follow you. I am using the indexed
tag, like described on the link you referred to, 


...

...


Thanks...

Regards,
Torsten



-Original Message-
From: suhas [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 3:57 PM
To: [EMAIL PROTECTED]
Subject: Re: Long Story short


Hi
I did not get why u need to explicitely put the FormBean in the request
scope when it will be done by struts for you .
I mean if u specify something like this in the JSP file





The form associated with the  will be retrieved
from the request scopr to render  ur  JSP page . This will be done for you
in the Struts-framework Why u doing this on your own ??/

Also the iterate tag should be indexed iterate tag  as against the normal
iterate tag as u want to update the data modified by user .
Check the Dave Hey's iterate tag in http://www.husted.com/about/struts/

Suhas





- Original Message -
From: Torsten Terp <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 19, 2001 10:01 AM
Subject: Re: Long Story short


> Hi,
>
> Although i have followed the example below i still have the problem with
saving
> the indexed fields. It is driving me nuts so if anybody who have it
working would
> take the time to see if they can spot the error i will be very very
greatfull.
>
> The source below is with a vector instead of an array. What happens is
that when
> the action code is executed the vector in the form is empy although the
simple String
> element is saved alright!
>
> My form looks like this:
>
> public final class ParametersForm extends ActionForm
> {
>// --- Instance
Variables
>
> private Vector parameterList = new Vector();
> private String tester;
>
>// ---
Properties
>
> public String getTester() { return tester; }
>
> public void setTester(String  v) { this.tester = v; }
>
> public Vector getParameterList() { return(this.parameterList); }
>
> public void setParameterList(Vector parameterList) { this.parameterList =
parameterList; }
>
> public Parameter getParameter(int index){ return
(Parameter)parameterList.elementAt(index); }
> }
>
> The Parameter class used for each row:
>
> public class Parameter {
>
> String key;
> String desc;
> String value;
>
> public String getKey() {return key;}
> public void setKey(String  v) {this.key = v;}
>
> public String getDesc() {return desc;}
> public void setDesc(String  v) {this.desc = v;}
>
> public String getValue() {return value;}
> public void setValue(String  v) {this.value = v;}
> }
>
> The action looks like this:
>
> public final class SaveParametersAction extends Action {
>
> // - Public
Methods
>
> public ActionForward perform(ActionMapping mapping,
>ActionForm form,
>HttpServletRequest request,
>HttpServletResponse response)
>throws IOException, ServletException {
>
> ParametersForm paramForm = (ParametersForm) form;
>
> // Get the simple tester
> String test = paramForm.getTester();
> System.out.println("paramForm tester was = '"+ test + "'");
>
> // Get the parameter list
> Vector paramList = paramForm.getParameterList();
> Parameter parm1 = new Parameter();
> parm1 = (Parameter)paramList.elementAt(0);
> System.out.println("parm1.getValue():"+parm1.getValue());
>
> // Forward control to the specified success URI
> return (mapping.findForward("success"));
> }
> }
>
> My JSP looks like this:
>
>
> <%
>file://cheating to get the objects in the request...
>
>ParametersForm parametersForm =  new ParametersForm();
>
>Vector parametersList = new Vector();
>
>Parameter parameter1 = new Parameter();
>Parameter parameter2 = new Parameter();
>
&

Re: Long Story short

2001-07-19 Thread suhas

Hi
I did not get why u need to explicitely put the FormBean in the request
scope when it will be done by struts for you .
I mean if u specify something like this in the JSP file





The form associated with the  will be retrieved
from the request scopr to render  ur  JSP page . This will be done for you
in the Struts-framework Why u doing this on your own ??/

Also the iterate tag should be indexed iterate tag  as against the normal
iterate tag as u want to update the data modified by user .
Check the Dave Hey's iterate tag in http://www.husted.com/about/struts/

Suhas





- Original Message -
From: Torsten Terp <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 19, 2001 10:01 AM
Subject: Re: Long Story short


> Hi,
>
> Although i have followed the example below i still have the problem with
saving
> the indexed fields. It is driving me nuts so if anybody who have it
working would
> take the time to see if they can spot the error i will be very very
greatfull.
>
> The source below is with a vector instead of an array. What happens is
that when
> the action code is executed the vector in the form is empy although the
simple String
> element is saved alright!
>
> My form looks like this:
>
> public final class ParametersForm extends ActionForm
> {
>// --- Instance
Variables
>
> private Vector parameterList = new Vector();
> private String tester;
>
>// ---
Properties
>
> public String getTester() { return tester; }
>
> public void setTester(String  v) { this.tester = v; }
>
> public Vector getParameterList() { return(this.parameterList); }
>
> public void setParameterList(Vector parameterList) { this.parameterList =
parameterList; }
>
> public Parameter getParameter(int index){ return
(Parameter)parameterList.elementAt(index); }
> }
>
> The Parameter class used for each row:
>
> public class Parameter {
>
> String key;
> String desc;
> String value;
>
> public String getKey() {return key;}
> public void setKey(String  v) {this.key = v;}
>
> public String getDesc() {return desc;}
> public void setDesc(String  v) {this.desc = v;}
>
> public String getValue() {return value;}
> public void setValue(String  v) {this.value = v;}
> }
>
> The action looks like this:
>
> public final class SaveParametersAction extends Action {
>
> // - Public
Methods
>
> public ActionForward perform(ActionMapping mapping,
>ActionForm form,
>HttpServletRequest request,
>HttpServletResponse response)
>throws IOException, ServletException {
>
> ParametersForm paramForm = (ParametersForm) form;
>
> // Get the simple tester
> String test = paramForm.getTester();
> System.out.println("paramForm tester was = '"+ test + "'");
>
> // Get the parameter list
> Vector paramList = paramForm.getParameterList();
> Parameter parm1 = new Parameter();
> parm1 = (Parameter)paramList.elementAt(0);
> System.out.println("parm1.getValue():"+parm1.getValue());
>
> // Forward control to the specified success URI
> return (mapping.findForward("success"));
> }
> }
>
> My JSP looks like this:
>
>
> <%
>file://cheating to get the objects in the request...
>
>ParametersForm parametersForm =  new ParametersForm();
>
>Vector parametersList = new Vector();
>
>Parameter parameter1 = new Parameter();
>Parameter parameter2 = new Parameter();
>
>parameter1.setKey("key0");
>parameter1.setDesc("desc0");
>parameter1.setValue("value0");
>parameter2.setKey("key1");
>parameter2.setDesc("desc1");
>parameter2.setValue("value1");
>
>parametersList.addElement(parameter1);
>parametersList.addElement(parameter2);
>
>parametersForm.setParameterList(parametersList);
>parametersForm.setTester("Testing non-indexed");
>
>pageContext.setAttribute("parametersForm", parametersForm,
PageContext.REQUEST_SCOPE);
> %>
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> tester:
> 
> 
> 
> 
> 
> 
> submit
> 
> 
> 
>
>
> And finally the struts-config.xml elements related to this:
>
> 
>
>   
> 
> type="full.classname.ParametersForm"/>
>   
>
>   
> 
> type="full.classname.SaveParametersAction"
>name="

Re: Long Story short

2001-07-19 Thread Torsten Terp
n anybody spot the error? If there is some more info
you need, just say so!

Thanks _alot_ in advance...

Regards,
Torsten


-Oprindelig meddelelse-----
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sendt: 12. juli 2001 20:00
Til: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Emne: Re: Long Story short

PLEASE IGNORE LAST POST!!!

Sorry, guys - please ignore my ramblings in the last post.  Was a mistake on my
part converting everything to arrays.

My iteration DOES work with arrays, as well as collections!  As follows:

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

   /**
* The parameter list
*/
   private Parameter[] parameterList;
   // --- Properties

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

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

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

In parameters.jsp:

  
  
  
 
bean:write name="parameter" property="key"/>

 
 

 
  
  
 

In my SaveParametersAction.java I simply get the paramList from the form and
process them...

   public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException
   {
  ...
  ParametersForm paramForm = (ParametersForm) form;

  // Get the parameter list
  Parameter[] paramList = paramForm.getParameterList();

 ...do stuff with paramList
   }

So, Frank, not sure what you're doing differently!  Maybe you can check the code
 above and see if you spot anything?

Cheers, and sorry for the confusion - too little sleep, I think!

Dave







RE: Long Story short

2001-07-12 Thread Niall Pemberton

What scope is your ActionForm in - request or session?

If its in session scope - no problem, if its request you need to make sure
your array is set up with all the beans it requires (empty ones will do).

Niall

> -Original Message-
> From: Frank Ling [mailto:[EMAIL PROTECTED]]
> Sent: 12 July 2001 00:04
> To: [EMAIL PROTECTED]
> Subject: Re: Long Story short
>
>
> Hi, Dave:
>
> Thanks for the reply, I did have form-bean define at my struts-config.xml,
> in the matter fact, I did get all other form-bean field setting back form
> HTML form except this attributes array.
>
> The reason I used the changed indexed tag of html:text for iterate tag, is
> recently all the thread on this mailing list regarding for
> Iterate property
> updating all recommend using your changed tag to have text name set like
> array items (I.e. attributes[n].value), then sounds like will help to set
> this value back to original array on my form bean. I just don't get it how
> this will be happen.
>
> I do have all my html:text name set like that way (i.e.
> attributes[n].value), but still get nothing setting back to my array, I do
> have all the setter method for element of the array.
>
> Do you know how your indexed tag will help on this matters?
>
> Thanks again.
>
> Frank Ling
>
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 11, 2001 2:22 PM
> Subject: Re: Long Story short
>
>
> >
> >
> > Frank,
> >
> > Do you have your struts-config set up correctly?  You might check that a
> new
> > form is not being created...
> >
> > Dave
> >
> > PS  Do you need the indexed naming?  If you don't, you don't need to use
> the
> > changed tags...
> >
> >
> >
> >
> > "Frank Ling" <[EMAIL PROTECTED]> on
> 07/11/2001
> > 01:19:29 PM
> >
> > Please respond to [EMAIL PROTECTED]
> >
> > To:   [EMAIL PROTECTED]
> > cc:(bcc: David Hay/Lex/Lexmark)
> > Subject:  Long Story short
> >
> >
> >
> > Hi, There:
> >
> > I send a long version story regarding for the Iteration tag with indexed
> tag
> > for property update. Not too much people response. Here is the short
> version
> > for that story.
> >
> > I get Dave hay's indexed tag work good with the Iterate tag for showing
> the
> > text field of my array attributes. I get attributes[n].value shows
> properly
> > on my JSP page. but nothing setting back to attributes array of my form
> > bean. the whole array is null after I received it on the next action
> class.
> >
> > Can anybody explain to me, why I get all these attributes[n].value shows
> as
> > the name of HTML text name, then that will automatically
> populate back to
> my
> > array? It's not working that way for me right now. what I did wrong. Any
> > suggestion will be highly appreciated.
> >
> > Thanks
> >
> > Best Regards
> >
> > Frank Ling
> >
> >
> >
> >
> >
> >
> >
> >
>




Re: Long Story short

2001-07-12 Thread Frank Ling

Dave:

Thanks so much for the help, I will give a try.

Regards

Frank Ling

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 9:38 AM
Subject: Re: Long Story short


>
>
> Frank,
>
> could you do me a favour?  Could you try using a collection eg Vector
instead of
> array in your form bean?  you should then have the equivalent of the
following
> in your form bean:
>
> public final class ParametersForm extends ActionForm
> {
>// --- Instance
Variables
>
>/**
> * The parameter list
> */
>private Vector parameterList = new Vector();
>// ---
Properties
>
>/**
> * Return the list of parameters
> */
>public Vector getParameterList()
>{
>   return(this.parameterList);
>}
>
>/**
> * Set the list of parameters
> *
> * @param parameterList The new list
> */
>public void setParameterList(Vector parameterList)
>{
>   this.parameterList = parameterList;
>}
>
>/**
> * Get a particular parameter from the parameterList, based on index
> *
> * @param   index The index of the parameter to retrieve
> */
>public Parameter getParameter(int index)
>{
>   return (Parameter)parameterList.elementAt(index);
>
>}
> }
>
> Let me know if that changes anything
>
> cheers,
>
> Dave
>
>
>
>
>
> "Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001
07:04:03
> PM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:(bcc: David Hay/Lex/Lexmark)
> Subject:  Re: Long Story short
>
>
>
> Hi, Dave:
>
> Thanks for the reply, I did have form-bean define at my struts-config.xml,
> in the matter fact, I did get all other form-bean field setting back form
> HTML form except this attributes array.
>
> The reason I used the changed indexed tag of html:text for iterate tag, is
> recently all the thread on this mailing list regarding for Iterate
property
> updating all recommend using your changed tag to have text name set like
> array items (I.e. attributes[n].value), then sounds like will help to set
> this value back to original array on my form bean. I just don't get it how
> this will be happen.
>
> I do have all my html:text name set like that way (i.e.
> attributes[n].value), but still get nothing setting back to my array, I do
> have all the setter method for element of the array.
>
> Do you know how your indexed tag will help on this matters?
>
> Thanks again.
>
> Frank Ling
>
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 11, 2001 2:22 PM
> Subject: Re: Long Story short
>
>
> >
> >
> > Frank,
> >
> > Do you have your struts-config set up correctly?  You might check that a
> new
> > form is not being created...
> >
> > Dave
> >
> > PS  Do you need the indexed naming?  If you don't, you don't need to use
> the
> > changed tags...
> >
> >
> >
> >
> > "Frank Ling" <[EMAIL PROTECTED]> on
07/11/2001
> > 01:19:29 PM
> >
> > Please respond to [EMAIL PROTECTED]
> >
> > To:   [EMAIL PROTECTED]
> > cc:(bcc: David Hay/Lex/Lexmark)
> > Subject:  Long Story short
> >
> >
> >
> > Hi, There:
> >
> > I send a long version story regarding for the Iteration tag with indexed
> tag
> > for property update. Not too much people response. Here is the short
> version
> > for that story.
> >
> > I get Dave hay's indexed tag work good with the Iterate tag for showing
> the
> > text field of my array attributes. I get attributes[n].value shows
> properly
> > on my JSP page. but nothing setting back to attributes array of my form
> > bean. the whole array is null after I received it on the next action
> class.
> >
> > Can anybody explain to me, why I get all these attributes[n].value shows
> as
> > the name of HTML text name, then that will automatically populate back
to
> my
> > array? It's not working that way for me right now. what I did wrong. Any
> > suggestion will be highly appreciated.
> >
> > Thanks
> >
> > Best Regards
> >
> > Frank Ling
> >
> >
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
>



Re: Long Story short

2001-07-12 Thread dhay



PLEASE IGNORE LAST POST!!!

Sorry, guys - please ignore my ramblings in the last post.  Was a mistake on my
part converting everything to arrays.

My iteration DOES work with arrays, as well as collections!  As follows:

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

   /**
* The parameter list
*/
   private Parameter[] parameterList;
   // --- Properties

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

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

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

In parameters.jsp:

  
  
  
 
bean:write name="parameter" property="key"/>

 
 

 
  
  
 

In my SaveParametersAction.java I simply get the paramList from the form and
process them...

   public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws IOException, ServletException
   {
  ...
  ParametersForm paramForm = (ParametersForm) form;

  // Get the parameter list
  Parameter[] paramList = paramForm.getParameterList();

 ...do stuff with paramList
   }

So, Frank, not sure what you're doing differently!  Maybe you can check the code
 above and see if you spot anything?

Cheers, and sorry for the confusion - too little sleep, I think!

Dave


-- Forwarded by David Hay/Lex/Lexmark on 07/12/2001 01:52 PM
---


David Hay
07/12/2001 01:11 PM

To:   [EMAIL PROTECTED]
cc:
Subject:  Re: Long Story short

Frank,

I have just tried mine with arrays, rather than collections, and does NOT work!

Can anyone explain why?  Presume it is something to do with getters/setters, but
would appreciate any insight...

Cheers,

Dave


-- Forwarded by David Hay/Lex/Lexmark on 07/12/2001 01:11 PM
---


David Hay
07/12/2001 12:38 PM

To:   [EMAIL PROTECTED]
cc:

Subject:  Re: Long Story short  (Document link: David Hay)

Frank,

could you do me a favour?  Could you try using a collection eg Vector instead of
array in your form bean?  you should then have the equivalent of the following
in your form bean:

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

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

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

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

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

   }
}

Let me know if that changes anything

cheers,

Dave




"Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001 07:04:03
PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Re: Long Story short



Hi, Dave:

Thanks for the reply, I did have form-bean define at my struts-config.xml,
in the matter fact, I did get all other form-bean field setting back form
HTML form except this attributes array.

The reason I used the changed indexed tag of html:text for iterate tag, is
recently all the thread on this mailing list regarding for Iterate property
updating all recommend using your changed tag to have text name set like
array items (I.e. attributes[n].value), then sounds like will help to set
this value back to original array on my form bean. I just don't get it how
this will be happen.

I do have all my html:text name set like that way (i.e.
attributes[n].value), but still get nothing setting back to my array, I do
have all the setter method for element of the array.

Do you know how your indexed tag will help on this matters?

Thanks again.

Frank Ling


- Original Message -
From:

Re: Long Story short

2001-07-12 Thread dhay



Frank,

I have just tried mine with arrays, rather than collections, and does NOT work!

Can anyone explain why?  Presume it is something to do with getters/setters, but
would appreciate any insight...

Cheers,

Dave


-- Forwarded by David Hay/Lex/Lexmark on 07/12/2001 01:11 PM
---


David Hay
07/12/2001 12:38 PM

To:   [EMAIL PROTECTED]
cc:

Subject:  Re: Long Story short  (Document link: David Hay)

Frank,

could you do me a favour?  Could you try using a collection eg Vector instead of
array in your form bean?  you should then have the equivalent of the following
in your form bean:

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

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

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

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

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

   }
}

Let me know if that changes anything

cheers,

Dave




"Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001 07:04:03
PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: Long Story short



Hi, Dave:

Thanks for the reply, I did have form-bean define at my struts-config.xml,
in the matter fact, I did get all other form-bean field setting back form
HTML form except this attributes array.

The reason I used the changed indexed tag of html:text for iterate tag, is
recently all the thread on this mailing list regarding for Iterate property
updating all recommend using your changed tag to have text name set like
array items (I.e. attributes[n].value), then sounds like will help to set
this value back to original array on my form bean. I just don't get it how
this will be happen.

I do have all my html:text name set like that way (i.e.
attributes[n].value), but still get nothing setting back to my array, I do
have all the setter method for element of the array.

Do you know how your indexed tag will help on this matters?

Thanks again.

Frank Ling


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 2:22 PM
Subject: Re: Long Story short


>
>
> Frank,
>
> Do you have your struts-config set up correctly?  You might check that a
new
> form is not being created...
>
> Dave
>
> PS  Do you need the indexed naming?  If you don't, you don't need to use
the
> changed tags...
>
>
>
>
> "Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001
> 01:19:29 PM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:(bcc: David Hay/Lex/Lexmark)
> Subject:  Long Story short
>
>
>
> Hi, There:
>
> I send a long version story regarding for the Iteration tag with indexed
tag
> for property update. Not too much people response. Here is the short
version
> for that story.
>
> I get Dave hay's indexed tag work good with the Iterate tag for showing
the
> text field of my array attributes. I get attributes[n].value shows
properly
> on my JSP page. but nothing setting back to attributes array of my form
> bean. the whole array is null after I received it on the next action
class.
>
> Can anybody explain to me, why I get all these attributes[n].value shows
as
> the name of HTML text name, then that will automatically populate back to
my
> array? It's not working that way for me right now. what I did wrong. Any
> suggestion will be highly appreciated.
>
> Thanks
>
> Best Regards
>
> Frank Ling
>
>
>
>
>
>
>
>












Re: Long Story short

2001-07-12 Thread dhay



Frank,

could you do me a favour?  Could you try using a collection eg Vector instead of
array in your form bean?  you should then have the equivalent of the following
in your form bean:

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

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

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

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

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

   }
}

Let me know if that changes anything

cheers,

Dave





"Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001 07:04:03
PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Re: Long Story short



Hi, Dave:

Thanks for the reply, I did have form-bean define at my struts-config.xml,
in the matter fact, I did get all other form-bean field setting back form
HTML form except this attributes array.

The reason I used the changed indexed tag of html:text for iterate tag, is
recently all the thread on this mailing list regarding for Iterate property
updating all recommend using your changed tag to have text name set like
array items (I.e. attributes[n].value), then sounds like will help to set
this value back to original array on my form bean. I just don't get it how
this will be happen.

I do have all my html:text name set like that way (i.e.
attributes[n].value), but still get nothing setting back to my array, I do
have all the setter method for element of the array.

Do you know how your indexed tag will help on this matters?

Thanks again.

Frank Ling


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 2:22 PM
Subject: Re: Long Story short


>
>
> Frank,
>
> Do you have your struts-config set up correctly?  You might check that a
new
> form is not being created...
>
> Dave
>
> PS  Do you need the indexed naming?  If you don't, you don't need to use
the
> changed tags...
>
>
>
>
> "Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001
> 01:19:29 PM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:(bcc: David Hay/Lex/Lexmark)
> Subject:  Long Story short
>
>
>
> Hi, There:
>
> I send a long version story regarding for the Iteration tag with indexed
tag
> for property update. Not too much people response. Here is the short
version
> for that story.
>
> I get Dave hay's indexed tag work good with the Iterate tag for showing
the
> text field of my array attributes. I get attributes[n].value shows
properly
> on my JSP page. but nothing setting back to attributes array of my form
> bean. the whole array is null after I received it on the next action
class.
>
> Can anybody explain to me, why I get all these attributes[n].value shows
as
> the name of HTML text name, then that will automatically populate back to
my
> array? It's not working that way for me right now. what I did wrong. Any
> suggestion will be highly appreciated.
>
> Thanks
>
> Best Regards
>
> Frank Ling
>
>
>
>
>
>
>
>









Re: Long Story short

2001-07-11 Thread suhas

Hope u have the tag similar to this -


// Here iterate tag is just acting as for loop .No use of scripting variable
"id"

// this will call getProductList ( index) followed by getProductName ( )

<% n ++ %>



Here n is the index variable .No need of using the **indexed iterate tag
** in above case .

Then have methods like

class myForm extends ActionForm {
private Vector  productList ;//  contains list of  Product objects .
public Product getProductList(int index) {
return (Product)productList(index);
}

public void setProductList( Vector list) {
productList =  list ;
}
}

The class Product  implements Serializable {
private String productName ;
private String productPrice;

 //   getter and setters
public String getProductName ( ) {
return productName ;
}
public void setProductName(String name ) {
this.prodctName = name ;
}
public String getProductPrice () {
return productPrice ;
}
public void setProductPrice(String price) {
this.productPrice = price ;
}

}

- Original Message -
From: Frank Ling <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 12:04 AM
Subject: Re: Long Story short


> Hi, Dave:
>
> Thanks for the reply, I did have form-bean define at my struts-config.xml,
> in the matter fact, I did get all other form-bean field setting back form
> HTML form except this attributes array.
>
> The reason I used the changed indexed tag of html:text for iterate tag, is
> recently all the thread on this mailing list regarding for Iterate
property
> updating all recommend using your changed tag to have text name set like
> array items (I.e. attributes[n].value), then sounds like will help to set
> this value back to original array on my form bean. I just don't get it how
> this will be happen.
>
> I do have all my html:text name set like that way (i.e.
> attributes[n].value), but still get nothing setting back to my array, I do
> have all the setter method for element of the array.
>
> Do you know how your indexed tag will help on this matters?
>
> Thanks again.
>
> Frank Ling
>
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 11, 2001 2:22 PM
> Subject: Re: Long Story short
>
>
> >
> >
> > Frank,
> >
> > Do you have your struts-config set up correctly?  You might check that a
> new
> > form is not being created...
> >
> > Dave
> >
> > PS  Do you need the indexed naming?  If you don't, you don't need to use
> the
> > changed tags...
> >
> >
> >
> >
> > "Frank Ling" <[EMAIL PROTECTED]> on
07/11/2001
> > 01:19:29 PM
> >
> > Please respond to [EMAIL PROTECTED]
> >
> > To:   [EMAIL PROTECTED]
> > cc:(bcc: David Hay/Lex/Lexmark)
> > Subject:  Long Story short
> >
> >
> >
> > Hi, There:
> >
> > I send a long version story regarding for the Iteration tag with indexed
> tag
> > for property update. Not too much people response. Here is the short
> version
> > for that story.
> >
> > I get Dave hay's indexed tag work good with the Iterate tag for showing
> the
> > text field of my array attributes. I get attributes[n].value shows
> properly
> > on my JSP page. but nothing setting back to attributes array of my form
> > bean. the whole array is null after I received it on the next action
> class.
> >
> > Can anybody explain to me, why I get all these attributes[n].value shows
> as
> > the name of HTML text name, then that will automatically populate back
to
> my
> > array? It's not working that way for me right now. what I did wrong. Any
> > suggestion will be highly appreciated.
> >
> > Thanks
> >
> > Best Regards
> >
> > Frank Ling
> >
> >
> >
> >
> >
> >
> >
> >




Re: Long Story short

2001-07-11 Thread Frank Ling

Hi, Dave:

Thanks for the reply, I did have form-bean define at my struts-config.xml,
in the matter fact, I did get all other form-bean field setting back form
HTML form except this attributes array.

The reason I used the changed indexed tag of html:text for iterate tag, is
recently all the thread on this mailing list regarding for Iterate property
updating all recommend using your changed tag to have text name set like
array items (I.e. attributes[n].value), then sounds like will help to set
this value back to original array on my form bean. I just don't get it how
this will be happen.

I do have all my html:text name set like that way (i.e.
attributes[n].value), but still get nothing setting back to my array, I do
have all the setter method for element of the array.

Do you know how your indexed tag will help on this matters?

Thanks again.

Frank Ling


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 11, 2001 2:22 PM
Subject: Re: Long Story short


>
>
> Frank,
>
> Do you have your struts-config set up correctly?  You might check that a
new
> form is not being created...
>
> Dave
>
> PS  Do you need the indexed naming?  If you don't, you don't need to use
the
> changed tags...
>
>
>
>
> "Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001
> 01:19:29 PM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:(bcc: David Hay/Lex/Lexmark)
> Subject:  Long Story short
>
>
>
> Hi, There:
>
> I send a long version story regarding for the Iteration tag with indexed
tag
> for property update. Not too much people response. Here is the short
version
> for that story.
>
> I get Dave hay's indexed tag work good with the Iterate tag for showing
the
> text field of my array attributes. I get attributes[n].value shows
properly
> on my JSP page. but nothing setting back to attributes array of my form
> bean. the whole array is null after I received it on the next action
class.
>
> Can anybody explain to me, why I get all these attributes[n].value shows
as
> the name of HTML text name, then that will automatically populate back to
my
> array? It's not working that way for me right now. what I did wrong. Any
> suggestion will be highly appreciated.
>
> Thanks
>
> Best Regards
>
> Frank Ling
>
>
>
>
>
>
>
>



Re: Long Story short

2001-07-11 Thread dhay



Frank,

Do you have your struts-config set up correctly?  You might check that a new
form is not being created...

Dave

PS  Do you need the indexed naming?  If you don't, you don't need to use the
changed tags...




"Frank Ling" <[EMAIL PROTECTED]> on 07/11/2001
01:19:29 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  Long Story short



Hi, There:

I send a long version story regarding for the Iteration tag with indexed tag
for property update. Not too much people response. Here is the short version
for that story.

I get Dave hay's indexed tag work good with the Iterate tag for showing the
text field of my array attributes. I get attributes[n].value shows properly
on my JSP page. but nothing setting back to attributes array of my form
bean. the whole array is null after I received it on the next action class.

Can anybody explain to me, why I get all these attributes[n].value shows as
the name of HTML text name, then that will automatically populate back to my
array? It's not working that way for me right now. what I did wrong. Any
suggestion will be highly appreciated.

Thanks

Best Regards

Frank Ling