我可以使用jsp标记在加载时隐藏输入字段吗 [英] Can I use a jsp tag to hide an input field on load

查看:51
本文介绍了我可以使用jsp标记在加载时隐藏输入字段吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要基于请求属性的值在页面加载时隐藏字段.我不想显示隐藏"字段,因为我想再次显示它.我不想用javascript做到这一点.如何使用jsp标签完成此操作?

I need to hide a field on page load based on the value of a request attribute. I don't want a 'hidden' field because I want to show it again. I don't want to do this with javascript. How is this done with jsp tags?

推荐答案

设置一个条件,如果条件为true,则显示为阻止状态.否则,如果条件为假,则将显示设置为无.

Set a condition where display is block if the condition is true. Else if the condition is false set the display to none.

<c:set var="inputDisplay" value="1" /> <!-- This same as your request attribute -->
<c:choose>
    <c:when test="${inputDisplay == 1}">
        <input type="text" />
    </c:when>
    <c:otherwise>
        <input type="text" style="display:none;" />
    </c:otherwise>      
</c:choose>

这篇关于我可以使用jsp标记在加载时隐藏输入字段吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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