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

Switch context lost when using div inside th:case #1002

Open
e-iceman opened this issue May 2, 2024 · 0 comments
Open

Switch context lost when using div inside th:case #1002

e-iceman opened this issue May 2, 2024 · 0 comments

Comments

@e-iceman
Copy link

e-iceman commented May 2, 2024

Found an apparent issue with the th:case tag and a nested div tag clearing the switch context before it should. I'm using Non Spring Thymeleaf version 3.0.11.

<th:block th:switch="${var}">
	<th:block th:case="'A'">
		<div>AA</div>
	</th:block>
	<th:block th:case="'B'">
		<span>BB</span>
	</th:block>
</th:block>

I get this error:
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Cannot specify a "{th:case,data-th-case}" attribute in an environment where no switch operator has been defined before.

If the div tag is changed to a span around the AA the error goes away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant