如何阻止用户输入h:inputText的文本? [英] How to stop the user in entering text for h:inputText?

查看:60
本文介绍了如何阻止用户输入h:inputText的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JSF 1.2-我的面孔实现.我有一个表单,我使用h:inputText显示一些值.有2个输入框,不应对其进行编辑,而应显示给用户,并在单击提交"后将其提交给服务器.我尝试了readonly ="true"和disable ="=" true,但都没有解决问题!有什么建议吗?

I am using JSF 1.2 - My Faces Implementation. I have a form , I use h:inputText to display few values. There are 2 input boxes which should not be edited but shown to the user and should be submitted to the server when the submit it clicked. I tried readonly="true" and disabled="true", both did not solve the purpose! Any suggestions?

推荐答案

readonly="true"应该适合您的要求.文本将不可编辑,并且值将被提交到服务器.

The readonly="true" should suit your requirements. The text will be uneditable and the value will be submitted to the server.

disabled="true"不符合您的要求.文本确实是不可编辑的,但是该值不会提交给服务器.

The disabled="true" don't suit your requirements. The text will indeed be uneditable, but the value won't be submitted to the server.

请注意,当您同时使用它们时,则根本不会提交该值.同样,如果在表单提交请求上有一个rendered属性或其父级之一,而该属性的值为false,则在表单提交请求的应用程序请求值阶段将不会收集该值.

Note that when you use them both, then the value won't be submitted at all. Also when there's a rendered attribute on it or one of its parents which evaluates to false during form submit, then the value won't be gathered during apply request values phase of the form submit request.

这篇关于如何阻止用户输入h:inputText的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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