检查 JSP 中的请求属性

发布于 2024-12-07 12:24:30 字数 284 浏览 4 评论 0原文

我正在尝试检查 jsp 中的请求属性以显示/隐藏某些 html。

request.setAttribute("submitted", "true");

jsp:

<c:if test="${submitted == 'false'}">
  // some html
</c:if>

但是无论我在属性中设置什么值,条件总是评估为 false。 该属性在条件内不可见吗?

萨希尔

I am trying to check a request attribute in a jsp to show/hide certain html.

request.setAttribute("submitted", "true");

jsp:

<c:if test="${submitted == 'false'}">
  // some html
</c:if>

But no matter what value I set in the attribute, the condition always evaluates to false.
Is the attribute not visible inside the condition?

Sahil

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一世旳自豪 2024-12-14 12:24:30

试试这个:

request.setAttribute("submitted", true);

在你的 JSP 中:

<c:if test="${submitted}">
    // some html
</c:if>    

Try this instead:

request.setAttribute("submitted", true);

and in your JSP:

<c:if test="${submitted}">
    // some html
</c:if>    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文