Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applying bootstrap styles to Struts 1.x html tags

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?

like image 657
Shantanu Paul Avatar asked Jun 29 '17 07:06

Shantanu Paul


1 Answers

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

like image 126
LeslieV Avatar answered Sep 21 '22 22:09

LeslieV