Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean n

OpenCV-Python实战(10)——详解 OpenCV 轮廓检测 在计算机视觉领域,轮廓通常指图像中对象边界的一系列点。因此,轮廓通常描述了对象边界的关键信息,包含了有关对象形状的主要信息,该信息可用于形状分析与对象检测和识别。在本文中,将首次通过简单示例了解轮廓的基本概念,然后通过实际示例来了解如何检测和压缩轮廓,最后利用介绍如何利用图像矩描述检测到的轮廓属性。 阅读详情

在学习spring 实战(第五版)2.3节验证form input时碰到这个问题。

在校验Taco的name格式时,做了如下设置

package com.example.tacocloud.bean;

import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

@Data
public class Taco {
    @Size(min=1, message="You must choose at least 1 ingredient")
    private List<String> ingredients;

    @NotNull
    @Size(min=5,  message="Name must be at least 5 characters long")
    private String name;
}

<!-- tag::all[] -->
<!-- tag::head[] -->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Taco Cloud</title>
    <link rel="stylesheet" th:href="@{/styles.css}" />
</head>

<body>
<h1>Design your taco!</h1>
<img th:src="@{/images/TacoCloud.png}"/>

<!-- tag::formTag[] -->
<form method="POST" th:object="${design}">
    <!-- end::all[] -->
    <span class="validationError"
          th:if="${#fields.hasErrors('ingredients')}"
          th:errors="*{ingredients}">Ingredient Error</span>

    <!-- tag::all[] -->
    <div class="grid">
        <!-- end::formTag[] -->
        <!-- end::head[] -->
        <div class="ingredient-group" id="wraps">
            <!-- tag::designateWrap[] -->
            <h3>Designate your wrap:</h3>
            <div th:each="ingredient : ${wrap}">
                <input name="ingredients" type="checkbox" th:value="${ingredient.id}" />
                <span th:text="${ingredient.name}">INGREDIENT</span><br/>
            </div>
            <!-- end::designateWrap[] -->
        </div>

        <div class="ingredient-group" id="proteins">
            <h3>Pick your protein:</h3>
            <div th:each="ingredient : ${protein}">
                <input name="ingredients" type="checkbox" th:value="${ingredient.id}" />
                <span th:text="${ingredient.name}">INGREDIENT</span><br/>
            </div>
        </div>

        <div class="ingredient-group" id="cheeses">
            <h3>Choose your cheese:</h3>
            <div th:each="ingredient : ${cheese}">
                <input name="ingredients" type="checkbox" th:value="${ingredient.id}" />
                <span th:text="${ingredient.name}">INGREDIENT</span><br/>
            </div>
        </div>

        <div class="ingredient-group" id="veggies">
            <h3>Determine your veggies:</h3>
            <div th:each="ingredient : ${veggies}">
                <input name="ingredients" type="checkbox" th:value="${ingredient.id}" />
                <span th:text="${ingredient.name}">INGREDIENT</span><br/>
            </div>
        </div>

        <div class="ingredient-group" id="sauces">
            <h3>Select your sauce:</h3>
            <div th:each="ingredient : ${sauce}">
                <input name="ingredients" type="checkbox" th:value="${ingredient.id}" />
                <span th:text="${ingredient.name}">INGREDIENT</span><br/>
            </div>
        </div>
    </div>

    <div>


        <h3>Name your taco creation:</h3>
        <input type="text" th:field="*{name}"/>
        <span class="validationError"
              th:if="${#fields.hasErrors('name')}"
              th:errors="*{name}">name Error</span>
        <br/>

        <button>Submit your taco</button>
    </div>
    <!-- tag::closeFormTag[] -->
</form>
<!-- end::closeFormTag[] -->
</body>
</html>
<!-- end::all[] -->
package com.example.tacocloud.controller;

import com.example.tacocloud.bean.Ingredient;
import com.example.tacocloud.bean.Ingredient.Type;
import com.example.tacocloud.bean.Taco;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;

@Slf4j
@Controller
@RequestMapping("/design")
public class DesignTacoController {

    @ModelAttribute
    public void addIngredientsToModel(Model model) {
        List<Ingredient> ingredients = Arrays.asList(
                new Ingredient("FLTO", "Flour Tortilla", Type.WRAP),
                new Ingredient("COTO", "Corn Tortilla", Type.WRAP),
                new Ingredient("GRBF", "Ground Beef", Type.PROTEIN),
                new Ingredient("CARN", "Carnitas", Type.PROTEIN),
                new Ingredient("TMTO", "Diced Tomatoes", Type.VEGGIES),
                new Ingredient("LETC", "Lettuce", Type.VEGGIES),
                new Ingredient("CHED", "Cheddar", Type.CHEESE),
                new Ingredient("JACK", "Monterrey Jack", Type.CHEESE),
                new Ingredient("SLSA", "Salsa", Type.SAUCE),
                new Ingredient("SRCR", "Sour Cream", Type.SAUCE)
        );

        Type[] types = Ingredient.Type.values();
        for (Type type : types) {
            model.addAttribute(type.toString().toLowerCase(),
                    filterByType(ingredients, type));
        }
    }

    //tag::showDesignForm[]
    @GetMapping
    public String showDesignForm(Model model) {
        model.addAttribute("design", new Taco());
        return "design";
    }

//end::showDesignForm[]


    @PostMapping
    public String processDesign(@Valid @ModelAttribute("design") Taco taco, Errors errors){
        if (errors.hasErrors()){
            return "design";
        }
        log.info("Processing design: " + taco);
        return "redirect:/orders/current";
    }

    private List<Ingredient> filterByType(List<Ingredient> ingredients, Type type){
        return ingredients.stream()
                .filter(x -> x.getType().equals(type))
                .collect(Collectors.toList());
    }
}

之所以出现这个错误是因为没有在processDesign方法的参数Taco 添加注解@ModelAttribute("design"),这个注解书中是没有添加的,想了很久不知道哪里有问题,后面才找到解决方法,添加这个注解之后问题就消失了。

参考1
参考2

【教程4>第4章>第20节】基于FPGA的costas环整体实现与仿真测试 Costas 环是一种用于载波同步的闭环反馈控制系统,主要应用于通信系统中的相干解调。其基本原理是通过鉴相器(Phase Detector,PD)比较接收信号与本地载波信号的相位差,将这个相位差信息经过环路滤波器(Loop Filter,LF)滤波后,去控制数控振荡器(Numerically Controlled Oscillator,NCO)的输出频率和相位,使得本地载波能够跟踪接收信号的载波,最终实现载波同步。Costas 环环路滤波器在载波同步过程中起着不可或缺的作用。 阅读详情

相关推荐

[GXYCTF2019]BabyUpload1 -- .htaccess文件解析与蚁剑实战指南

本文深入解析了[GXYCTF2019]BabyUpload1文件上传漏洞的实战利用。通过绕过后缀名与内容检测,上传包含PHP代码的.jpg文件,并利用.htaccess文件强制服务器将其解析为PHP脚本。文章详细介绍了.htaccess的原理、构造方法、Content-Type绕过技巧,并演示了如何使用中国蚁剑连接Webshell获取Flag,为Web安全学习提供了完整实战指南。

weixin_29016315的博客 507

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'user'

场景:在《spring+mybatis企业应用实战》一书中第五章,当使用spring mvc国际化时,因为在jsp中没有引入一个实体类(在Page 90页有个loginForm.jsp代码),导致运行时抛出异常:java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name '

Jalen备忘录 2万+

Zephyr RTOS线程间通讯实战:消息队列与信号量的5个经典应用场景

本文深入探讨了Zephyr RTOS中线程间通讯的核心机制,通过消息队列与信号量的组合,详细解析了传感器数据处理流水线、命令分发系统、日志记录、资源池管理以及周期性任务协同调度等5个经典应用场景。这些实战模式为构建高效、稳定且可维护的嵌入式多线程系统提供了清晰的设计蓝图和代码范例。

tomato的博客 94

springmvc表单错误:java.lang.IllegalStateException: Neither BindingResult nor plain target object for bea...

参考见:http://blog.csdn.net/wendellup/article/details/8352090 今天在使用springmvc 控制器跳转到新增页面时,报错了: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'comman...

weixin_30410119的博客 1029

ZYNQ-7035+HMCAD1511高速数据采集系统设计

高速数据采集是电子测量、雷达信号处理与通信基带验证的核心技术基础,其性能瓶颈常集中于采样率、通道同步性与实时处理能力。基于ADC采样原理与SoC异构架构,高带宽、低抖动时钟链路与FPGA+ARM协同处理成为突破关键。ZYNQ-7035凭借275K逻辑单元与千级DSP资源,显著提升LVDS数据流吞吐与片上滤波/触发等实时算法部署能力;HMCAD1511则以1GSPS四通道同步采样和8位分辨率,满足示波器级动态范围需求。该组合广泛应用于嵌入式信号采集平台开发、教学实验系统构建及国产化仪器原型验证。

weixin_28939623的博客 260

【推荐100个unity插件】实现逼真的雪与雨系统——Weatherade: Snow and Rain System

Weatherade是一款Unity雪天/雨天场景创建系统,支持内置RP和URP渲染管线,提供雪/雨覆盖着色器、地形支持、雪痕效果等特性。安装后需配置URP渲染器,通过添加覆盖实例和转换材质实现效果,支持手动调整或批量转换工具快速应用。系统包含完整演示场景,可通过官方文档了解更多配置细节。下载地址:Unity Asset Store或百度网盘学习版。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 1215

java.lang.IllegalStateException

场景:最近在写功能需求时,给jsp页面传递数据,系统报异常。 异常如下:java.lang.IllegalStateException:Neither BindingResult nor plain target object for bean name ‘ywPersonCardHouse’ available as request attribute 查找资料原因如下:当使用spring mv...

weixin_43375485的博客 636

uniapp [安卓苹果App端] - 实现获取手机日历读写权限+调用本机日历数据及操作功能+日历中插入事项事件提醒,检测权限手机日历权限是否开启并引导用户同意授权,uniApp app端开启日历授权

uni-app,权限,手机日历权限,安卓Android,苹果ios,uniapp安卓android获取本机日历读写权限使用,uni-app获取日历权限并实现插入事项事件功能 uniapp苹果IOS系统不支持怎么办,判断权限,权限被拒绝了怎么办,获取日历权限报错,读取日历数据农历阴历并操作插入移除,给用户手机日历中放入一条提示,UniApp调用日历进行读写,打包上架后如何获取,安卓ios权限检测,安卓和ios权限获取,uniapp的APP端日历读写权限与使用示例代码,如何开启日历权限,日历的新增事项和删除,判

🏆 前端领域优质创作者 1万+

thymeleaf 表单报错 Neither BindingResult nor plain target object for bean name 'XXX' available

今天使用 thymeleaf 模板做项目遇到了页面内容显示不出来,报错 Neither BindingResult nor plain target object for bean name 'orderListQuery' available as request attribute 然后,找了很多方法,最后发现是。。。。。没定义 报错信息     java.lang.Illega...

Dalon_G的博客 1万+

CUDA编程00 - 配置CUDA开发环境

第一步:在一台装有Nvidia显卡和驱动的机器上,用nvidia-smi命令查看显卡所支持cuda版本。安装时按提示下一步即可,安装完成用 nvcc -V 命令检查是否成功。第二步: 到Nvidia官网下载CUDA Toolkit并安装,第三步:编写HelloWorld。

GPU全栈博主 1359

ZYNQ microblaze boot.bin固化步骤

一,ZYNQ移植软核的原理FPGA规模巨大而且功能复杂,因此设计的每一个部分都从头开始是不切实际的。一种解决的办法是:对于较为通用的部分可以重用现有的功能模块,而把主要的时间和资源用在设计中的那些全新的、独特的部分。这就像是你在开发应用程序的时候就不用直接去写驱动物理硬件的代码,而是直接调用Windows提供的API就行了。

wangjie36的博客 2780

java.lang.IllegalStateException: Neither BindingResult nor plain target object f

严重: Neither BindingResult nor plain target object for bean name 'command' available as request attribute java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ...

iteye_6697的博客 669

基于STM32设计的掌上游戏机(运行NES游戏模拟器)详细开发过程

利用STM32单片机移植NES游戏模拟器,完成NES游戏开发,可以玩标准的NES游戏,已测试超级玛丽、魂斗罗之类的都可以正常运行。

4万+

SpringMVC java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean n...

当跳转到一个含有form表单的页面的时候 如<form:form commandName="useCarInfo" 必须要new一个useCarInfo的同名实例给jsp来接收表单中的参数, 否则报出异常 org.apache.jasper.JasperException: java.lang.IllegalStateException: Neither BindingResult...

weixin_34223655的博客 160

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Spring实战第五版第二章字段校验返回视图报错解决及javax.validation完整pom依赖

Spring实战第五版第二章 2.3 校验表单输入 在编写"/design"页面post处理逻辑时,按照书本上直接'return "design";'方式,会报如下错误: Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'design' available as request attribute at org.springframewo.

scold301的博客 1972

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name

springmvc数据校验并回显时报错 java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name "student" available as request attribute 参考只这位大哥的博客 https://blog.csdn.net/kevingavinh...

D1124615130的博客 2992

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Neither BindingResult nor plain target object for bean name ‘command‘ available as request attribute

报错信息: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute 错误原因: 使用了springMVC中带有的form表单标签; 该标签具有自动回显的功能,回显的内容就在request域中分为两种情况: ① (不指定modelAttribute属性) 默认回显request中属性名为comman

好俗好麻烦的博客 1041

解决Caused by: java.lang.IllegalStateException:

通过调整JVM的-Xss参数、检查循环继承依赖项和更新相关库和依赖,我们可以解决​​Caused by: java.lang.IllegalStateException: 由于StackOverflower错误无法完成对web应用程序[/lib]的批注的扫描​​异常。在解决这个问题时,我们需要对应用程序的结构和依赖进行深入的分析和调试,以确定根本原因并采取相应的措施。当我们开发Web应用程序时,有时候会遇到上述的​​异常。

牛肉胡辣汤 1万+

Neither BindingResult nor plain target object for bean name 'mailor' available as request attribute

错误原因如下: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'mailor' available as request attribute org.springframework.web.servlet.support.BindStatus.(Bin

Jin 2771

Neither BindingResult nor plain target object for bean name 'xxx' available as request attribut

在SpringMVC中测试表单标签时可能会出现这个错误,Neither BindingResult nor plain target object for bean name ‘xxx’ available as request attribute 出错的原因,第一个可能是在 <form:form modelAttribute=“xxx” method=“post” action="/xxx...

weixin_44339867的博客 7835

SSM时遇到的异常(3)——IllegalStateException: Neither BindingResul..plain target object for bean ..'command'

JDK1.7+Tomcat7.0+Eclipse+SSM 十二月 27, 2018 9:01:00 下午 org.apache.catalina.core.ApplicationDispatcher invoke 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: Nei...

風的博客 1359

java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘user‘

这个错误如果时在Springboot 使用BindingResult校验参数时,看看是否是下面这种情况。 前端页面addUser.html <form th:action="@{/user/addUser}" method="post" > 姓名:<input type="text" name="username"><span th:errors="${user.username}" style="color:red"></span&gt

L'Étranger的博客 2279

HTTP Status 500错误

HTTP Status 500 - java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute 发生的错误:在请求域例没有command这样的属性 path="last

Just The Way You Are 1万+

问题:Neither BindingResult nor plain target object for bean name 'xxxxxx' available as request attribu

原因:前端页面的问题,一定要看仔细,基本上是跳转的时候出现了问题,错在路径上。

W_a_n_g_X_的博客 842

springmvc报错Neither BindingResult nor plain target object for bean name 'command' available as reques

用springmvc做商品的增删改查,修改商品进行表单回显时会报错 Neither BindingResult nor plain target object for bean name ‘command’ available as request attribute 在表单的form属性加上commandName=“glist” 这样就可以表单回显了,然后修改数据提交。 ...

luomo0203的博客 489

出现错误Neither BindingResult nor plain target object for bean name

看到的比较全面的解决方法link

darknightbatman的博客 3826
上一篇: Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found
下一篇: IntellijIDEA设置实现spring boot 热重启
濯君
博客等级 码龄11年 148粉丝 195原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值