【问题标题】:JSP text field read onlyJSP 文本字段只读
【发布时间】:2019-04-25 04:44:35
【问题描述】:

请告诉我如何使用 JSP 使 JSP 文本文件只读?在 html 中我们可以使用

<input type = "text" name="someName" readonly/>

但是我们如何使用 JSP 做同样的事情。(如果我想禁用基于用户帐户类型的文本字段?)

【问题讨论】:

  • 也许你从对象liek(请求或会话)返回值是否具有只读值并将其作为只读值放入标签

标签: java html jsp jakarta-ee


【解决方案1】:

根据参数添加readOnly属性,例如

String readOnly = "CAN_READ".equals(request.getParameter("userAccountType")) ? "readOnly" : "";

并在输入中使用它:

<input type = "text" name="someName"<%=readOnly%> />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-24
    • 1970-01-01
    • 2020-05-11
    • 2015-05-11
    • 1970-01-01
    • 1970-01-01
    • 2014-01-16
    • 1970-01-01
    相关资源
    最近更新 更多