struts html:link custom attribute

て烟熏妆下的殇ゞ 提交于 2019-12-11 19:22:13

问题


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.


回答1:


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>


来源:https://stackoverflow.com/questions/17166664/struts-htmllink-custom-attribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!