// if "indexed=true", add "index=x" parameter to query string
// * @since Struts 1.1
if( indexed ) {
// look for outer iterate tag
IterateTag iterateTag =
(IterateTag) findAncestorWithClass(this, IterateTag.class);
if (iterateTag == null) {
// This tag should only be nested in an iterate tag
// If it's not, throw exception
JspException e = new JspException
(messages.getMessage("indexed.noEnclosingIterate"));
TagUtils.getInstance().saveException(pageContext, e);
throw e;
}
//calculate index, and add as a parameter
if (params == null) {
params = new HashMap(); //create new HashMap if no other params
}
if (indexId != null) {
params.put(indexId, Integer.toString(iterateTag.getIndex()));
} else {
params.put("index", Integer.toString(iterateTag.getIndex()));
}
}
String url = null;
try {