我是Springboot的初学者,所以决定在购物车上工作。似乎找不到org.springframework.expression.spel.SpelEvaluationException:名称的根:在null上找不到属性或字段‘EL1007E’。嵌套异常是计算SpringEL表达式时出现的org.thymeleaf.exceptions.TemplateProcessingException:异常:"#request.userPrincipal.name“(模板:"/_header”-第11行,第48列)]具有根本原因 我已经尝试检查有问题的对象是否为空 if (userDe
@Controller
public static class forLostController {
@GetMapping("/losing")
public String lostingForm(Model model) {
model.addAttribute("losing", new lostUser());
return "losing";
}
@PostMapping("/losing")
如何解决这个错误?我将thymeleaf和spring一起使用,在解析下面的html片段时出现错误。 org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'items' cannot be found on null当我向购物车添加一些东西时,它起作用了。问题是当它是空的时候。 ` <tr th:each="item : ${session.shoppingCart.items}">
<td th:text=
我有这样的课程
public class Guardian {
public Guardian() {
super();
}
private Long id;
private String name;
..
}
public class AlarmNotification {
private Long id;
private Guardian guardian;
}
在我的Thymeleaf模板中
<td class="col_name" th:text="${alarmNotific
如果${object}为null,则*{item}访问它的项将导致:
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'item' cannot be found on null
因此,如何解决这个问题--我希望保留div结构,如下面的示例所示,当currentUser为null时,包含城市和名称的div保持不变。
<div class="form" th:object="${currentUser}">
我是Spring/REST的新手,在创建了一个新的律师之后得到了这个错误,我有一个适当映射了firstName字段的律师表。print语句输出当前数据。我不确定为什么数据没有到达模板。任何建议都将不胜感激。
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'firstName' cannot be found on null
这是我的控制器:
@RequestMapping(value = "/register", method = R
我有一个使用SpringMVC和Thymeleaf的spring引导项目。我在layout.html中定义了一个页脚,它包含在每个页面中。是否在页脚上包含一个显示每个页的“状态”的调用。这样,当您浏览网站时,页脚将始终显示所需的信息?
我有一个REST控制器,它放置一个Status对象:
@Controller
public class StatusController {
@RequestMapping(value = "/status", method = RequestMethod.GET)
public String get(Model model) {
S
我有一个Spring / Thymeleaf应用程序,
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'projectName' cannot be found on null
但是,页面看起来很正常。所有变量都是用数据呈现的。我只是担心每次请求都会抛出一个异常。
下面是控制器:
@Controller
@RequestMapping("/download")
public class AppDownloaderCon
我有以下SPel表达式:
custData.address[0].postcode
custData是一个现有的对象,但address是一个空列表。它是一个现有的对象,但它是空的。当我试图在这个路径上设置一个邮政编码时,我得到了
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'postcode' cannot be found on null
我需要的是,一个新的address对象将被放到列表中并设置它的postcode属性。
它是可以在SPel表达
我不知道为什么,当我张贴空表单时,我会有这个错误。
org.springframework.expression.spel.SpelEvaluationException:地址:在null上找不到属性或字段‘EL1007E’
在我张贴表格之前:
@GetMapping("/new")
public String showCreateFormForEmployeeAndAddresses(Model model) {
if(addressService.getCheck()== false) {
for (int i = 1; i <= 2
我刚从春天开始,所以请容忍我。我刚刚解决了代码中的一个错误,它来自于我的假设,即一旦将属性添加到任何Model对象,它也可以用于其他端点的模板实现。
@GetMapping("/user_page")
public String getUserPage( Model model ) {
Page page = new Page();
model.addAttribute("user_page", page);
return "user_page";
在我的Thymeleaf模板中,我能够在u
我已经为我的web应用程序完全配置了SPRING方法安全性。(启用了前/后注释)。
但是最近我遇到了一个奇怪的问题。摘要如下:
POJOS概述
// User class public class User { int id;String name;// getters和setters } // Group Class public class Group { int id;String name;// getters和setters } // GroupMembership类公共类GroupMembership {私有int id;私有用户;私有组;// getters和setters
我有三个表,它们是一对一的关系。第一个表是省实体,区实体是一个与省和人的实体的关系,因为每个人都居住在地区上。我想访问thymleaf中的地区信息。
@Entity
@Table (name = "provinces")
public class Province {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int provinceId;
@Column(name="province_name",unique=true,length = 25,
好的,所以我试着把一个对象的属性从模型放到视图中,作为一个列表,使用晶闸管,spring引导和jpa,我已经读了几个小时的代码,我似乎找不到我的问题,在同一个应用程序中,我有一个非常相似的函数工作,所以我知道如何做它,但我似乎找不出这个问题。我一直收到一个错误Property or field 'question' cannot be found on null。我不知道我哪里出了问题。我拥有的对象是QuestionAnswerSet,我在数据库中有一个问题字符串和一个答案字符串,可以通过应用程序提交,所以数据库没有问题。而且,使用我的pom文件一切都很好,因为正如我前面所说,
我试图在我的spring应用程序中使用thymeleaf处理表单提交,我集成了
在我的应用程序上运行得很好。我正在尝试改变它,但这是我作为一个异常所得到的
org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'recruiter' cannot be found on null
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(Prope
我想使用SpEL来评估一些谓词。由于值/属性是动态的,所以我没有特定的bean类。因此,我们有一个hashmap,其中(根据应用程序状态)键映射到不同的POJO/bean,例如:
Person person = new Person();// a person instance
person.setAge(25) // e.g. property age
Map<String, Object> model = new HashMap<>();
model.put("person", person);
// and others ...
我们期
每次在我的存储库中调用findByFirstNameContainingOrLastNameContaining函数时,我都会收到以下错误:
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'firstName' cannot be found on null
我的查询是错误的吗?我对这个错误一无所知
以下是我的文件:
Person.java
package com.model;
import javax.persistence.En