Hi Nicola,

Believe there is a way to extract it already (but never used it)...but If you
only need the index for javascript, can't you obtain it from the name of your
indexed field ie pass the field in as a param to your function?

I do this with a button defined with
                   <html:button property="y" value="reset" indexed="true"
onclick="setParamDefault(this)"/>

and my function is

function setParamDefault(button)
{
    var myName = button.name;
   var start = myName.indexOf("[") + 1;
   var length = myName.indexOf("]") - start;
   var index = myName.substr(start, length);

   document.ParametersForm["parameter[" + index + "].value"].value =
document.ParametersForm["parameter[" + index + "].defaultValue"].value

}

Cheers,

Dave






Nicola Taylor <[EMAIL PROTECTED]> on 08/14/2001
12:00:21 PM

Please respond to [EMAIL PROTECTED]

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



Hi,

were using the indexed properties tags and it'd be useful to know the
current index in the jsp (to do some javascript stuff).  Is there any
standard way to access the current index in the iterator?

1) write a custom tag to return:
IterateTag iterateTag = (IterateTag) findAncestorWithClass(this,
IterateTag.class);
iterateTag.getIndex();

2) have a counter variable that we increment within the iterate loop.

Cheers


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

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

www.mimesweeper.com
**********************************************************************






Reply via email to