Primefaces 3.5.10,Mojarra 2.1.21,Omnifaces 1.5
我正在考虑安全问题 .
我使用component.getAttributes()方法设置了component属性 . 此方法返回带有属性的HashMap . 在此映射中设置(“disabled”,true) - pair以禁用组件(例如p:inputText-component)是否安全?我在jsf管道的actionListener(阶段5或4)中使用它 . 所以它可能仅对渲染阶段有影响 . 但是我可以在客户端上从输入法操作disabled属性,然后发布被操纵的值 . 如果组件被禁用,服务器是否进行测试并拒绝更改?
什么是最好的方式?
panelGrid中的所有组件都将被禁用:
xhtml:
<p:panelGrid>
<my:component/>
<p:input value=#{mybean.value} />
</p:panelGrid>
Bean:
for (UIComponent component : l) {
component.getAttributes().put("disabled", true);
recursion(....);
}
1 回答
是的,最终用户可以 .
是的,JSF基于组件树状态而不是提交的值来完成它 . 那部分是安全的 . 顺便说一句,它也适用于
readonly
和rendered
attribtues .另见:
Why JSF saves the state of UI components on server?
Which properties in a JSF backing bean can be set by a user?
commandButton/commandLink/ajax action/listener method not invoked or input value not updated(第5点)