You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/06/15 10:06:00 UTC
[jira] [Work logged] (WW-5256) Reduce size of generate html out of freemarker tag templates
[ https://issues.apache.org/jira/browse/WW-5256?focusedWorklogId=1025164&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1025164 ]
ASF GitHub Bot logged work on WW-5256:
--------------------------------------
Author: ASF GitHub Bot
Created on: 15/Jun/26 10:05
Start Date: 15/Jun/26 10:05
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #1743:
URL: https://github.com/apache/struts/pull/1743
## Summary
In 7.2.0, `FreemarkerManager` disabled FreeMarker whitespace stripping whenever `devMode` was enabled (`whitespaceStripping && !devMode`). This regressed behavior versus 6.x and had two visible effects in development:
- **`s:textarea` rendered blank lines** — the `<#if nameValue??>` / `</#if>` directive lines inside `<textarea>…</textarea>` were no longer collapsed, and whitespace there is *significant* page content, so an empty textarea showed up as blank lines on screen.
- **Bloated HTML output** — every directive-only line across all UI templates emitted its newline/indentation.
The `&& !devMode` term also overrode the `struts.freemarker.whitespaceStripping` setting, leaving developers no way to re-enable stripping while in devMode.
This change makes whitespace stripping governed solely by `struts.freemarker.whitespaceStripping` (default `true`), restoring 6.x behavior by default while keeping an explicit opt-out. The now-unused `devMode` field/setter/injection (added in 7.2.0 only for this coupling) is removed, and the constant's Javadoc is updated.
## Changes
- `FreemarkerManager`: drop the `&& !devMode` coupling; remove the dead `devMode` field, `setDevMode` setter and its `@Inject`.
- `StrutsConstants`: remove the stale "Automatically disabled when devMode is enabled" note from `STRUTS_FREEMARKER_WHITESPACE_STRIPPING`.
- Tests: remove the two devMode-coupling tests; keep default-on and explicit-off coverage.
- Design + implementation plan docs under `docs/superpowers/`.
## Test Plan
- [x] `mvn test -DskipAssembly -pl core -Dtest=FreemarkerManagerTest` — passes
- [x] `mvn test -DskipAssembly -pl core -Dtest=TextareaTest` — passes (rendering guard)
- [x] `mvn test -DskipAssembly -pl core` — full core module, 2969 tests, 0 failures
Fixes [WW-5256](https://issues.apache.org/jira/browse/WW-5256)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1025164)
Time Spent: 4.5h (was: 4h 20m)
> Reduce size of generate html out of freemarker tag templates
> ------------------------------------------------------------
>
> Key: WW-5256
> URL: https://issues.apache.org/jira/browse/WW-5256
> Project: Struts 2
> Issue Type: Improvement
> Components: Core Tags
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.2.0
>
> Time Spent: 4.5h
> Remaining Estimate: 0h
>
> Currently tags are producing a lot of white-space characters and line breaks due to how Freemarker handles all the white-space characters. This can be improved by using a few helpful directtives:
> [https://freemarker.apache.org/docs/dgui_misc_whitespace.html]
> One of them is the [<#compress>|https://freemarker.apache.org/docs/dgui_misc_whitespace.html#autoid_30] directive.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)