After perusing the source code I don't feel like this is possible, but if y'all know otherwise please give me a heads-up even if just to confirm my suspicion. It appears that Struts2 does know the ID of the current form, but this information is not used for an xwork validation context -- which appears to be either at the action or method level. Some thought would have to go into how best to put a solution on the ValueStack for backwards compatibility.
To refresh your memories (from yesterday) here's the situation I found myself in: <#-- tl;dr -- Is it possible to set a validation context specific to a form ID, or to add field errors to a data structure representing one unique form? These three forms share an input with the same name, but could be distinct instances of domain objects. If one is submitted and does not validate(), the FieldError is shown on all three forms instead of just the one that was submitted. Furthermore, since each textfield is named "msg" then "getMsg()" is called via OGNL for all forms, so all inputs have the same value after submission. It'd be great if the tags could first check a form-specific data structure for value and error info. --> <#list [ 1, 2, 3 ] as idx > <@s.form id="ff${idx?c}"> <#-- Struts does not generate unique IDs automatically in this case, so for valid HTML you must provide the ID explicitly. No action param is defined, so the form will submit to the same page. --> <@s.hidden name="msg.id" value="${idx?c}" /> <@s.textfield name="msg" labelposition="left" label="Message ${idx?c}" /> <@s.submit /> </@s.form> </#list> --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org