Skip to content

WW-3429 Add configurable checkbox hidden field prefix#1570

Open
lukaszlenart wants to merge 1 commit intomainfrom
feat/WW-3429-configurable-checkbox-prefix
Open

WW-3429 Add configurable checkbox hidden field prefix#1570
lukaszlenart wants to merge 1 commit intomainfrom
feat/WW-3429-configurable-checkbox-prefix

Conversation

@lukaszlenart
Copy link
Member

Summary

  • Add struts.ui.checkbox.hiddenPrefix constant to allow configuring the checkbox hidden field prefix
  • Default value __checkbox_ maintains backward compatibility
  • Addresses HTML validation warnings about double underscores (HTML Tidy)
  • Users can set struts_checkbox_ or other prefix for HTML5 compliance

Fixes WW-3429

Changes

File Change
StrutsConstants.java Add STRUTS_UI_CHECKBOX_HIDDEN_PREFIX constant
default.properties Add default value __checkbox_
Checkbox.java Inject constant, pass to template
CheckboxInterceptor.java Inject constant, use in prefix matching
simple/checkbox.ftl Use ${attributes.hiddenPrefix}
html5/checkbox.ftl Use ${attributes.hiddenPrefix}
CheckboxHandler.java Get prefix from component parameters
CheckboxInterceptorTest.java Add tests for configurable prefix
CheckboxTest.java (javatemplates) Fix test for correct hidden field value

Configuration

Default (backward compatible):
No configuration needed - uses __checkbox_

HTML5 Compliant:

<constant name="struts.ui.checkbox.hiddenPrefix" value="struts_checkbox_"/>

Or in struts.properties:

struts.ui.checkbox.hiddenPrefix=struts_checkbox_

Test plan

  • Run CheckboxInterceptorTest - 12 tests pass
  • Run CheckboxTest (core) - 21 tests pass
  • Run CheckboxTest (javatemplates) - 6 tests pass
  • Manual verification with showcase app

🤖 Generated with Claude Code

Add struts.ui.checkbox.hiddenPrefix constant to allow configuring
the checkbox hidden field prefix, addressing HTML validation warnings
about double underscores while maintaining backward compatibility.

Changes:
- Add STRUTS_UI_CHECKBOX_HIDDEN_PREFIX constant to StrutsConstants
- Add default value __checkbox_ to default.properties
- Update Checkbox component to inject and pass prefix to templates
- Update CheckboxInterceptor to use configurable prefix
- Update simple/checkbox.ftl and html5/checkbox.ftl templates
- Update CheckboxHandler in javatemplates plugin
- Add tests for configurable prefix functionality
- Fix bug in CheckboxHandler where value was incorrectly prefixed

Configuration example:
  struts.ui.checkbox.hiddenPrefix=struts_checkbox_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant