JSF 2.0去掉了需要的HTML5属性 [英] JSF 2.0 strips out needed HTML5 attributes

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

问题描述

我与一个JSF团队合作开展前端开发。我们输出一个INPUT字段,并且需要在渲染标签中包含 placeholder 和一些 data - 属性。然而,JSF正在剥离这些。我不知道JSF足够对JSF团队有什么帮助,但我认为我至少可以问问。



我们使用的是旧版本的JSF,但是升级到2.0,因为它似乎支持HTML5。情况并非如此吗?有没有一种已知的方法来解决这个问题?

解决方案

JSF并不完全剥离它们。它只是忽略它们,因为它们不在所讨论组件的支持/已知属性之中。例如< h:inputText> (默认呈现HTML < input type =text> 标签),您可以在查看声明语言(VDL)文档

为了解决这个问题,你需要创建一个自定义组件,或者更好的只是一个自定义渲染器,它将覆盖标准的< h:inputText> 渲染器并将自定义属性考虑在内。


I work with a JSF team doing the front end development. We're outputting an INPUT field and I need to include placeholder and a few data- attributes into the rendered tag. The JSF is stripping these out, however. I don't know JSF enough to be of much help to the JSF team, but thought I could at least ask around.

We were using an older version of JSF but upgraded to 2.0 as it appeared that it would support HTML5. Is that not the case? Is there a known way to work around this?

解决方案

JSF isn't exactly stripping them out. It's just ignoring them because they are not among the supported/known attributes of the component in question. In case of for example <h:inputText> (which renders by default a HTML <input type="text"> tag), you can find all supported attributes in the view declaration language (VDL) documentation.

To overcome this, you would need to create a custom component or, better, just a custom renderer which overrides the standard <h:inputText> renderer and takes the custom attributes into account.

这篇关于JSF 2.0去掉了需要的HTML5属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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