yes niall, it's name of hindu god. but i am just a human ;-)
pual, did it help you???
----- Original Message -----
From: "Niall Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 8:31 PM
Subject: RE: multiple form fields (I HATE CTRL-S )
> Paul,
>
> 1) The reason you're getting "null pointer error for the attribute
indexed"
> is because Dave's tags initialise "indexed" to null - you have to set it
to
> "true" or "false" in your jsp.
>
> i.e. <html:text name="parameter" property="value" indexed="true"/>
>
> 2) You seem to be setting up your data incorrectly in your jsp
>
> Typically an action of yours would run off, get some data and load it into
> your ActionForm which then forward to a jsp to display/edit.
>
> I'm not sure why you've got it in your jsp, but anyway what you've done
isnt
> right - its creating your vector BUT isntead of putting it in your
> actionForm, your storing it as a page scope parameter under the name
> "ParameterList".
>
> Instead of this:
>
> pageContext.setAttribute("ParameterList", vin,
PageContext.PAGE_SCOPE);
>
> You should be doing something like:
>
> salesordercreateForm.setParameterList(vin);
>
> My suggestion too keep it simple, take that stuff out of your jsp and put
it
> in the constructor of your ActionForm - then you know its always going to
be
> present (dont have to worry about scope). Anyway as you have it at the
> moment youre always going to have any empty vector - so you wont see
> anything.
>
> i.e. something like
>
> public class SalesOrderCreateForm extends ActionForm {
>
> public SalesOrderCreateForm() {
> parameterList.add(0,new
> SapValidParameter("orderitemsin_itmnumber","00010"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_material","TEST"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_billdate","20000101"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_plant","2000"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_targetqty","1000"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_shorttext","TEST"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_reqdate","20000101"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_matlgroup","2000"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_purchdate","20000101"));
> parameterList.add(0,new
> SapValidParameter("orderitemsin_currency","USD"));
> }
>
> etc. etc.
>
> 3) Rama Krishna's (isnt he a Hindu God?) put up a reply for you about
Vector
> or Vectors (havent done that flavour myself), so if you can get that
working
> to display your data youre half way there.
>
> Niall
>
>
> > -----Original Message-----
> > From: Paul Beer [mailto:[EMAIL PROTECTED]]
> > Sent: 29 June 2001 03:35
> > To: Struts-User
> > Subject: RE: multiple form fields (I HATE CTRL-S )
> >
> >
> >
> >
> > OK here's my bad code. There are two problems Im try to resollve here
:
> >
> > 1) i cant iterate through a vector (how do i give the html tag an
> > enumerator
> > ???)
> > 2) even though i rebuilt struts w/tags from husted.com i get a
> > null pointer
> > error for the attribute "indexed"
> >
> > i can get iterations to work with simple ine dimensional arrays,
> > but what i
> > really want to do is input a grid of data as a vector of vectors. so
> > basically what is below is only a broken half the implementation i
need...
> > the other thing i need to know is how to "set" this data in the
formBean.
> > does this method do it :
> >
> > public void setParameterList(Vector parameterList)
> > {
> > this.parameterList = parameterList;
> > }
> >
> > first here's the errors I am trying to get around :
> >
> > Attribute 'indexed' not found in tag library 'null' for the tag text.
> >
> >
> > I also get no results form the vector iteration below.
> >
> >
> >
> > here's the JSP :
> >
> >
> > <html:form>
> >
> > { java.util.Vector vin = new java.util.Vector();
> > vin.add(0,new SapValidParameter("orderitemsin_itmnumber","00010"));
> > vin.add(0,new SapValidParameter("orderitemsin_material","TEST"));
> > vin.add(0,new
SapValidParameter("orderitemsin_billdate","20000101"));
> > vin.add(0,new SapValidParameter("orderitemsin_plant","2000"));
> > vin.add(0,new SapValidParameter("orderitemsin_targetqty","1000"));
> > vin.add(0,new SapValidParameter("orderitemsin_shorttext","TEST"));
> > vin.add(0,new SapValidParameter("orderitemsin_reqdate","20000101"));
> > vin.add(0,new SapValidParameter("orderitemsin_matlgroup","2000"));
> > vin.add(0,new
SapValidParameter("orderitemsin_purchdate","20000101"));
> > vin.add(0,new SapValidParameter("orderitemsin_currency","USD"));
> > pageContext.setAttribute("ParameterList", vin,
> > PageContext.PAGE_SCOPE);
> > }
> >
> >
> > %>
> >
> >
> > <ol>
> > <logic:iterate id="parameter" name="salesordercreateForm"
> > property="parameterList">
> >
> > <html:text name="parameter" property="value" />
> >
> > </logic:iterate>
> > </ol>
> >
> > </html:form>
> >
> >
> >
> >
> >
> >
> > </body>
> > </html:html>
> >
> >
> >
> >
> > here's the form code :
> >
> > /**
> > * The parameter list
> > */
> > private Vector parameterList = new Vector();
> >
> >
> > /**
> > * Return the list of parameters
> > */
> > public Vector getParameterList()
> > {
> > return(this.parameterList);
> > }
> >
> > public String getParameters()
> > {
> > return(this.parameterList.toString());
> > }
> >
> > /**
> > * 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 SapValidParameter getParameter(int index)
> > {
> > return (SapValidParameter)parameterList.elementAt(index);
> >
> > }
> >
> >
> > -----Original Message-----
> > From: Niall Pemberton [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 28, 2001 5:40 PM
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: RE: multiple form fields
> >
> >
> > Hey thats what this list is for - your headaches as valid as anyone
elses,
> > keep sending them until you get a result.
> >
> > Post all the bits of code in an email - your action form and/or
> > bean(s) and
> > the jsp - plus when is throwing the Null pointer exception, - in the
jsp,
> > before your page is displaying or afterwards when its trying to populate
> > back?
> >
> > Off the top of my head you might be getting null pointer exceptions for
a
> > couple of reasons:
> >
> > 1) If its happening before your page is displayed it might be
> > because there
> > are nulls in your array/collection/vector - make sure its all
> > loaded/initialised containing no nulls before you forward to your
> > jsp page.
> >
> > 2) If its happening after you submit your form back (using Daves
> > tags) then
> > check the scope of your form - if its in session scope you should
> > be OK, if
> > its in request scope you will need to do something clever to set it up
> > again. Struts effectively does a getXxxxx(index).setYxxxx(value) call
> >
> > Anyway, if you post your code it'll be easier to see whats happening.
> >
> > You are using Dave's modified tags from husted.com?
> >
> > Niall
> >
> > > -----Original Message-----
> > > From: Paul Beer [mailto:[EMAIL PROTECTED]]
> > > Sent: 29 June 2001 00:56
> > > To: [EMAIL PROTECTED]
> > > Subject: RE: multiple form fields
> > >
> > >
> > > Im still having problems getting this. I just started using struts so
> > > please bear with me here. But can someone please email me
> > > something similar
> > > to the logic-iterate example that cmoes with the
> > example-taglibs demo ? I
> > > am getting null pointer errors and I dont if it is my struts
> > > distribution or
> > > my own inability to grock this....
> > >
> > > i will try not to toxify this list with any more of this ....
> > > its just that
> > > if I cant model a formbean w/a grid of data struts is worthless to me,
> > > because my whole world is executing functions w/import tables.
> > >
> > > -paul
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, June 28, 2001 1:54 PM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: RE: multiple form fields
> > >
> > >
> > >
> > >
> > > Paul,
> > >
> > > a concrete example using modified tag:
> > >
> > > jsp:
> > > <logic:iterate id="parameter" name="ParametersForm"
> > > property="parameterList">
> > > .................
> > > <html:text name="parameter" property="value"
indexed="true"
> > > onchange="validate(this)"/>
> > > .................
> > > </logic:iterate>
> > >
> > >
> > > in my form bean (using a vector):
> > >
> > > public final class ParametersForm extends ActionForm
> > > {
> > > /**
> > > * The parameter list
> > > */
> > > private Vector parameterList = new Vector();
> > >
> > >
> > > /**
> > > * 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);
> > >
> > > }
> > > }
> > >
> > > Hope that helps,
> > >
> > > Dave
> > >
> > >
> > >
> > >
> > >
> > > "Paul Beer" <[EMAIL PROTECTED]> on
06/28/2001
> > > 02:32:55 PM
> > >
> > > Please respond to
[EMAIL PROTECTED];
> > > Please
> > > respond to [EMAIL PROTECTED]
> > >
> > > To: [EMAIL PROTECTED]
> > > cc: (bcc: David Hay/Lex/Lexmark)
> > > Subject: RE: multiple form fields
> > >
> > >
> > >
> > > sorry i send the email accidently :
> > >
> > > doesnt :
> > >
> > > ...
> > > <INPUT type="text" name="qty" value="1">
> > > <INPUT type="text" name="qty" value="2">
> > > <INPUT type="text" name="qty" value="3">
> > > ...
> > >
> > > In your class:
> > >
> > > String[] qtys = request.getParameterValues("qty");
> > >
> > >
> > > defeat the purpose of having a form bean which seems like a kind
> > > of servlet
> > > abstraction of an html form ? i dont really care. I would just
> > > like to see
> > > some sample code that works. I have searched through the
> > quagmire that is
> > > the mail archives and every thread ends w/confusing comments.
> > >
> > > -p
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>