struts html:link custom attribute

2019-09-05 09:02发布

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

I tried with

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

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

Attribute data-toggle invalid for tag link according to TLD

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

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

标签: jsp struts
1条回答
对你真心纯属浪费
2楼-- · 2019-09-05 09:07

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

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

<dynamic-attributes>true</dynamic-attributes>
查看更多
登录 后发表回答