Thymeleaf:如何获取URL属性值 [英] Thymeleaf: how to get URL attribute value

查看:1334
本文介绍了Thymeleaf:如何获取URL属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到使用Thymeleaf从URL获取属性的任何解决方案. 例如,对于URL:

I can't find any solution for getting attribute from URL using Thymeleaf. For example, for URL:

somesite.com/login?error=true

我需要获取错误"属性值. 如果有帮助的话,我也在使用SpringMVC.

I need to get "error" attribute value. Also I'm using SpringMVC, if it could be helpful.

推荐答案

经过一番调查,我发现这实际上是Spring EL问题.因此,使用null检查的完整答案是:

After some investigation I found that it was Spring EL issue actually. So complete answer with null checking is:

<div id="errors" th:if="${(param.error != null) and (param.error[0] == 'true')}">
    Input is incorrect
</div>

这篇关于Thymeleaf:如何获取URL属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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