简体   繁体   English

将引导程序样式应用于Struts 1.x html标签

[英]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. 我正在使用Struts html标签而不是标准html标签处理一些旧的Struts 1.x应用程序。 I am trying to modernize the UI without making functional changes. 我试图在不进行功能更改的情况下使UI现代化。

For example: The input field is <html:text property="someProperty" styleClass="someCssStyle"> 例如:输入字段为<html:text property="someProperty" styleClass="someCssStyle">

instead of <input type="text" class="someCssStyle"> 代替<input type="text" class="someCssStyle">

If I change, <html:text> to <input type="text"> the property binding breaks ie the value in input field is not passed to the code. 如果更改,则<html:text><input type="text">的属性绑定将中断,即输入字段中的值不会传递给代码。

If I try to apply bootstrap styles to <html:text> , it does not work. 如果我尝试将引导样式应用于<html:text> ,那么它将无法正常工作。

How can I apply Bootstrap styles to legacy struts html tags? 如何将Bootstrap样式应用于旧的struts html标签?

You have add the style(s) to the styleClass attribute. 您已将样式添加到styleClass属性。

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 这是GitHub上一个非常基本的示例应用程序,显示了此工作方式: https : //github.com/lviviani/sample-struts-bootstrap

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM