TagWriter can write empty attribute
See gh-910
This commit is contained in:
committed by
Rossen Stoyanchev
parent
3f7dec0b0d
commit
913cc079af
@@ -98,6 +98,19 @@ public class TagWriter {
|
|||||||
.append(attributeValue).append("\"");
|
.append(attributeValue).append("\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an empty HTML attribute with the specified name.
|
||||||
|
* <p>Be sure to write all attributes <strong>before</strong> writing
|
||||||
|
* any inner text or nested tags.
|
||||||
|
* @throws IllegalStateException if the opening tag is closed
|
||||||
|
*/
|
||||||
|
public void writeAttribute(String attributeName) throws JspException {
|
||||||
|
if (currentState().isBlockTag()) {
|
||||||
|
throw new IllegalStateException("Cannot write attributes after opening tag is closed.");
|
||||||
|
}
|
||||||
|
this.writer.append(" ").append(attributeName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write an HTML attribute if the supplied value is not {@code null}
|
* Write an HTML attribute if the supplied value is not {@code null}
|
||||||
* or zero length.
|
* or zero length.
|
||||||
|
|||||||
Reference in New Issue
Block a user