struts html:link自定义属性 [英] struts html:link custom attribute

查看:83
本文介绍了struts html:link自定义属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Apache Struts与BootStrap css结合使用,该菜单将自定义css样式data-toggle="dropdown"用于其菜单.

I'm trying to use Apache Struts with BootStrap css which uses the custom css attibute data-toggle="dropdown" for its menus.

我尝试过

<html:link action="/Home" styleClass="dropdown-toggle" data-toggle="dropdown">
                    <bean:message key="menu.person" />
</html:link>

但是不允许data-toggle="dropdown",但在NetBeans中会出现错误:

However data-toggle="dropdown" is not allowed, in NetBeans it gives error:

Attribute data-toggle invalid for tag link according to TLD

如何将data-toggle之类的自定义属性放在<html:link>中?

How do I put a custom property like data-toggle inside an <html:link>?

到目前为止,我只能看到id和class属性.

So far I can see only id and class properties are allowed.

推荐答案

什么版本? IIRC更高版本的S1允许任意属性,但我必须仔细检查.

What version? IIRC later versions of S1 allow arbitrary attributes, but I'd have to double-check.

如果无法升级,请提取TLD并对其进行修改,以允许在JSP 2.0下使用任意属性:

If you cannot upgrade, extract the TLD and modify it to allow arbitrary attributes under JSP 2.0:

<dynamic-attributes>true</dynamic-attributes>

这篇关于struts html:link自定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆