前言

  • thymeleaf 3.0.5
  • springboot 2.0.0.RELEASE

错误现象

控制台打印错误信息

Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Access to request parameters is forbidden in this context. Note some restrictions apply to variable access. For example, direct access to request parameters is forbidden in preprocessing and unescaped expressions, in TEXT template mode, in fragment insertion specifications and in some specific attribute processors. (template: "app/xxx" - line 50, col 23)at org.thymeleaf.standard.expression.RestrictedRequestAccessUtils$RestrictedRequestWrapper.createRestrictedParameterAccessException(RestrictedRequestAccessUtils.java:87)at org.thymeleaf.standard.expression.RestrictedRequestAccessUtils$RestrictedRequestWrapper.getParameter(RestrictedRequestAccessUtils.java:68)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:120)at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:134)at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:53)at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:360)at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:89)at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:111)at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:334)at org.thymeleaf.spring5.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:263)at org.thymeleaf.standard.expression.VariableExpression.executeVariableExpression(VariableExpression.java:165)at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:66)at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109)at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138)at org.thymeleaf.standard.processor.StandardUtextTagProcessor.doProcess(StandardUtextTagProcessor.java:87)at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314)at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205)at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136)at org.thymeleaf.engine.TemplateManager.process(TemplateManager.java:519)at org.thymeleaf.util.LazyProcessingCharSequence.writeUnresolved(LazyProcessingCharSequence.java:85)at org.thymeleaf.util.AbstractLazyCharSequence.write(AbstractLazyCharSequence.java:103)at org.thymeleaf.engine.AbstractTextualTemplateEvent.writeContent(AbstractTextualTemplateEvent.java:224)at org.thymeleaf.engine.Text.write(Text.java:78)at org.thymeleaf.engine.OutputTemplateHandler.handleText(OutputTemplateHandler.java:71)... 70 common frames omitted

代码写法

[(${#request.getParameter('deptno')})]

解决办法

改正写法:

[[${#request.getParameter('deptno')}]]

问题解决。

【thymeleaf】Access to request parameters is forbidden in this context相关推荐

  1. 【kafka】Unexpected handshake request with client mechanism GSSAPI, enabled mechanisms are

    文章目录 1.概述 1.概述 首先参考kafka的配置环境:[kafka]kerberos认证下 kafka 报错Bootstrap broker host:ip (id: -1 rack: null ...

  2. 【spring boot】【thymeleaf】SPEL调用静态方法和静态属性

    前言 spring boot 2.1.1.RELEASE thymeleaf 3.0 静态属性 <sapn th:text="${T(java.lang.Math).PI}" ...

  3. 【Thymeleaf】获取绝对路径

    前言 thymeleaf 3.0 获取绝对路径 使用Thymeleaf模板引擎想要拼出绝对路径 <a th:href="${#request.getScheme() + '://' + ...

  4. 后端程序员如何写出优雅的前端试图【Thymeleaf】

    Thymeleaf Thymeleaf 是一个现代服务器端 Java 模板引擎,适用于 Web 和独立环境. [官网地址]:https://www.thymeleaf.org/ 文章目录 Thymel ...

  5. 好消息acesse_【好消息】“Access Bars能量清理疗愈”公益讲座报名即日开始!

    Bars能为你带来什么? o    睡眠质量改善,白天神清气爽: o    内心轻松喜悦,心智充满荣耀: o    有效释放压力,具环境宁静感: o    身心涣然轻盈,神态容颜年轻: o    获得 ...

  6. 【thymeleaf】【SpringBoot】在HTML中调用Spring Bean

    前言 spring boot : 2.0.0.RELEASE maven eclipse thymeleaf 3.0 某些情况下需要在HTML中调用Service.比如:做CMS系统时提供的随时获取文 ...

  7. 【JavaWeb】Access restriction The type is not accessible due to restriction on required library

    MyEclipse无法访问到jar包的解决方法 MyEclipse中编写Java代码时,用到了BASE64Decoder import sun.misc.BASE64Decoder: 和图片处理相关的 ...

  8. 【thymeleaf】【SpringBoot】Thymeleaf 获取.properties中的配置项变量

    前言 略. Thymeleaf 获取.properties中的配置项变量 假设我在 Thymeleaf 中写JavaScript的时候,发现我需要读取application.properties中的配 ...

  9. 【thymeleaf 】在 thymeleaf 中使用 shiro 标签

    前言 sprint boot 2.3.4.RELEASE 说明 shiro 未提供对 thymeleaf 的支持.第三方项目 thymeleaf-extras-shiro 提供了在 thymeleaf ...

最新文章

  1. java sql 结果_Java中的SQL结果集
  2. android+录像中截图软件下载,录屏截图大师app
  3. 京东11.11携手小米上线“信用试”服务 手机先试用满意再付款
  4. 联想高校AI精英挑战赛移师冰城,哈工大上演人工智能创业大秀
  5. [Python] 函数来判断一个对象是否是一个已知的类型:isinstance(object, classinfo)
  6. python画地图学校_python使用pyecharts库画地图数据可视化的实现
  7. NP-Hard问题浅谈
  8. C4—Qt实现记事本(二)2021-11-16
  9. DEM生成等高线及提取等高线3+1种方法
  10. vivado ooc综合
  11. Java集合框架中隐藏的设计套路
  12. 微信公众平台编辑模式
  13. 关于vscode中出现gopls was not able to find modules in your workspace报错的解决方案
  14. day16re模块和面向对象
  15. 令人头疼的优化问题——多目标规划问题matlab求解
  16. 同指数幂相减公式_指数幂的指数幂的运算法则
  17. MySql字段内容加密与解密
  18. win7和linux下的文件共享
  19. 【软件测试的计划和策略】
  20. 【Oauth认证】使用scribe实现OAUTH

热门文章

  1. Linux学习第二步(Java环境安装)
  2. (42) Aeroo 模板实战
  3. Linux系统如何在开机时修改root密码
  4. mac下anaconda安装selenium+PhantomJS
  5. @ResponseBody,@RequestBody,@PathVariable
  6. Oracle字符分隔函数(split)
  7. mootools 简介
  8. PHP多进程之pcntl扩展的使用详解
  9. PHP用单例模式实现一个数据库类
  10. 上传问题总结(文件大小检测,大文件上传)