struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Index within iterate tags
Date Tue, 14 Aug 2001 16:46:06 GMT

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"

and my function is

function setParamDefault(button)
    var myName =;
   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




Nicola Taylor <> on 08/14/2001
12:00:21 PM

Please respond to

To:   "Struts-User (E-mail)"
cc:    (bcc: David Hay/Lex/Lexmark)
Subject:  Index within iterate tags


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,

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


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.

View raw message