I am working on some legacy Struts 1.x applications that use Struts html tags instead of standard html tags. I am trying to modernize the UI without making functional changes.
For example:
The input field is <html:text property="someProperty" styleClass="someCssStyle">
instead of <input type="text" class="someCssStyle">
If I change, <html:text>
to <input type="text">
the property binding breaks i.e. the value in input field is not passed to the code.
If I try to apply bootstrap styles to <html:text>
, it does not work.
How can I apply Bootstrap styles to legacy struts html tags?
You have add the style(s) to the styleClass
attribute.
For example:
<html:text property="propName" name="formName" styleClass="form-control"></html:text>
or
<html:submit styleClass="btn btn-link">submit</html:submit>
Here is a very basic sample app on GitHub that shows this working: https://github.com/lviviani/sample-struts-bootstrap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With