spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.28k stars 37.99k forks source link

<form:errors> tag cannot be used in jspf (fragment) compilation units, where no <form:form> tag exists, even though it would work. [SPR-2753] #7441

Closed spring-projects-issues closed 12 years ago

spring-projects-issues commented 17 years ago

Patrick Haren opened SPR-2753 and commented

The tag checks to see if it is within a form tag, using TagUtils.assertHasAncestorOfType(this, FormTag.class, "errors", "form"); It looks like this is the only <form:*> tag that does this check.

This limits where the tag can be used to only a jsp compilation unit that contains the tag. Thus, it cannot be used in a jspf (fragment) that would be embedded within another jsp that contains the .

A workaround for now is to define a new tag library, with an alternate errors tag based on a class that derives from org.springframework.web.servlet.tags.form.ErrorsTag and overrides the onWriteTagContent() function. The new version simply does nothing (i.e. doesn't do the form check assert).

This workaround was tested and allows us to use the 'improved' tag within a jspf.


Affects: 2.0 final

Issue Links:

spring-projects-issues commented 17 years ago

Rick Evans commented

Fixed. The ErrorsTag no longer does an explicit check... I guess folks will have to read the documentation that states that the \ tag must be used nested within a \

tag now.

Thanks for taking the time to report this.