Dave,

Thank you very much for the help!!  That seems to have done the trick.  I
won't make that mistake again.  I think the hard part was that Struts never
generated an error when it couldn't find the appropriate setter.  The sample
code really helped as well.  Thanks again!

Thank You,


Mike Ashamalla, CEBS
VistaXtreme
[EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 05, 2001 9:18 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Indexed tags & iterate tag problems




Taking a closer look at your code - first thing to check is capitalization
of
your EmploymentInfoField - it must have a small 'e' - lots of messages about
bean naming scheme in list, eg
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg04762.html.

Cheers,

Dave







"Mike Ashamalla" <[EMAIL PROTECTED]> on
12/04/2001 03:39:25 PM

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

To:   "Struts Users Mailing List"
      <[EMAIL PROTECTED]>
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  RE: Indexed tags & iterate tag problems



Anyone know the answer to this???  It seems that there are two of us with
exactly the same problem (see "iterate tag problems (sorry !!)" from Eddie
Fung [[EMAIL PROTECTED]]).

Bottom line: When using indexed tags inside an iterate tag, the setters
don't seem to be setting the new values.

If this has already been answered elsewhere, please just point us in the
right direction. :)

Thank You,


Mike Ashamalla, CEBS
VistaXtreme
[EMAIL PROTECTED]

-----Original Message-----
From: Mike Ashamalla [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 03, 2001 6:42 PM
To: Struts-User
Subject: Indexed tags


Hi All!

I apologize if this question has been asked before.  I'm trying to implement
indexed tags and I can't figure out where the values are being set (ie -
where should me setters be and what should they look like).  The form
displays the prompts and values perfectly, but when I submit it the new
values don't seem to be posting to the formbean.  I've read as many posts
and archives as I could find, but still don't see what I'm doing wrong.  One
archived post stated "... this will be translated by struts into a call
ParametersForm.getParameter(0).setValue(value) ...".  The setValue method in
EmploymentInfoField (see below) is not being called, though.  No errors are
being generated either (when I submit the form).  The HTML source that is
produced looks like this: <input type="text"
name="EmploymentInfoField[0].value" size="30" value="East Coast">

BTW - I'm using Struts nightly build from 11/28/2001 and Tomcat 3.2.2

I've seen many posts that didn't have enough information/code for people to
help, so I'm including as much as possible.  Sorry for the long post.  Thank
you in advance!

****************************************************************************
***********
JSP Code:

       <logic:iterate id="EmploymentInfoField" name="EmploymentInfoForm"
property="employmentInfoFieldList"
type="com.mydomain.form.EmploymentInfoField">
        <tr>
          <td width="41">&nbsp;</td>
              <td width="112">
                <div class="formLabel" align="right"><bean:message
name="EmploymentInfoField" property="labelKey"/></div>
              </td>
              <td width="168">
                <div align="left">
                  <html:text name="EmploymentInfoField" property="value"
indexed="true" size="30"/>
                  </div>
              </td>
        </tr>
        </logic:iterate>
****************************************************************************
***********
****************************************************************************
***********
EmploymentInfoForm:

public class EmploymentInfoForm extends ActionForm {

private Vector employmentInfoFieldList = new Vector();

...

    public EmploymentInfoField getEmploymentInfoField(int index) {
        return (EmploymentInfoField) employmentInfoFieldList.get(index);
    }

    public Vector getEmploymentInfoFieldList() {
        return employmentInfoFieldList;
    }

    private void addEmploymentInfoField(String dbFieldName,
                                        int dataType,
                                        String labelKey,
                                        String value) {
        EmploymentInfoField eField;

        eField = new EmploymentInfoField();
        eField.setDbFieldName(dbFieldName);
        eField.setDataType(dataType);
        eField.setLabelKey(labelKey);
        eField.initValue(value);
        employmentInfoFieldList.add(eField);
    }
}
****************************************************************************
***********
****************************************************************************
***********
EmploymentInfoField:

public class EmploymentInfoField {

private int dataType;
private String dbFieldName = null;
private String labelKey = null;
private String value = null;
private boolean valueChanged = false;

    /**
     * Return the dataType
     *
     * @return the dataType
     */
    public int getDataType() {
        return dataType;
    }

    /**
     * Set the dataType.
     *
     * @param dataType The new dataType
     */
    public void setDataType(int dataType) {
      this.dataType = dataType;
    }

    /**
     * Return the dbFieldName
     *
     * @return the dbFieldName
     */
    public String getDbFieldName() {
        return dbFieldName;
    }

    /**
     * Set the dbFieldName.
     *
     * @param dbFieldName The new dbFieldName
     */
    public void setDbFieldName(String dbFieldName) {
      this.dbFieldName = dbFieldName;
    }

    /**
     * Return the labelKey
     *
     * @return the labelKey
     */
    public String getLabelKey() {
        return labelKey;
    }

    /**
     * Set the labelKey.
     *
     * @param labelKey The new labelKey
     */
    public void setLabelKey(String labelKey) {
      this.labelKey = labelKey;
    }

    /**
     * Return the value
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * Initialize the value.
     *
     * @param value The new value
     */
    public void initValue(String value) {
      this.value = value;
    }

    /**
     * Set the value.
     *
     * @param value The new value
     */
    public void setValue(String value) {
      if(value.equals(this.value)) {
        valueChanged = false;
      } else {
        valueChanged = true;
      }
      this.value = value;
    }

    /**
     * Return whether or not value has changed.
     *
     * @return String
     */
    public boolean getValueHasChanged() {
      return valueChanged;
    }
}
****************************************************************************
***********

Thank You,


Mike Ashamalla, CEBS
VistaXtreme
[EMAIL PROTECTED]


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


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








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


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

Reply via email to