Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support empty attributes in TagWriter #910

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ public void writeAttribute(String attributeName, String attributeValue) throws J
this.writer.append(" ").append(attributeName).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}
Expand Down