解决Unable to find setter method for attribute: [commandName]
最近学习springmvc的表单标签库,其中form标签主要用于渲染HTML表单,而form标签有很多属性,可供选择,其中一般来说(以前)最重要的是commandName属性,因为它定义了模型属性的名称,包含了一个backing object,其属性是用来填充说生成的表单的内容的。同时,使用此属性要求在后台的请求处理方法中添加相应的模型属性进行返回,这样commandName才能生效,简单代码如下:
<form:form action="/book_save" method="post" commandName="book">
model.addAttribute("book", new Book());
最终的结果如题所示:Unable to find setter method for attribute: [commandName]。
解释下原因:
学习的内容较旧了,贴出spring-form.tld中的一点东西
<attribute>
<description>DEPRECATED: Use "modelAttribute" instead.</description>
<name>commandName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
这个属性其实已经过时了,现在应该使用modelAttribute属性,使用方法相同。
解决Unable to find setter method for attribute: [commandName]的更多相关文章
- Java报错:Unable to find setter method for attribute: [x]
在学习JavaWeb JSTL与自定义标签时遇到的坑,用的老师给的代码结果直接原地报错:javax.servlet.ServletException: org.apache.jasper.Jasper ...
- Unable to find setter method for attribute: 属性名
tld文件里面的名称和标签内的属性名要一致.
- 自定义标签 Unable to find setter method for attribute
变量的首字母不能大写 http://blog.csdn.net/looksun/article/details/7690601
- is not writable or has an invalid setter method错误的解决
java中在配置spring时,遇到is not writable or has an invalid setter method的错误一般是命名方式的问题 需要写成private userInfoD ...
- ERROR: HHH000123: IllegalArgumentException in class: com.tt.hibernate.helloworld.News, setter method of property: date
问题描述: Hibernate连接数据库时,报出如下错误: 十一月 29, 2016 3:08:31 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execut ...
- 错误:Bean property 'sessionFactory' is not writable or has an invalid setter method.
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' ...
- Log4j2 - Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFileAppender for element RollingFile
问题与分析 在使用Log4j2时,虽然可以正确读取配置文件并生成log文件,但偶然发现控制台打印了异常信息如下: 2018-12-31 17:28:14,282 Log4j2-TF-19-Config ...
- Android Unable to execute dex: method ID not in [0, 0xffff]: 65536 问题解决方法
开始一个新项目的时候,Build工程的时候一直报这个错误: 控制台报错误:Conversion to Dalvik format failed: Unable to execute dex: meth ...
- org.springframework.beans.NotWritablePropertyException:Bean property 'xxxService' is not writable or has an invalid setter method.
完整报错提示信息:Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'blogDe ...
随机推荐
- 设置Linux环境的欢迎登陆信息
1.编辑/etc/profile文件添加如下内容: for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ &quo ...
- 隐藏17年的Office远程代码执行漏洞(CVE-2017-11882)
Preface 这几天关于Office的一个远程代码执行漏洞很流行,昨天也有朋友发了相关信息,于是想复现一下看看,复现过程也比较简单,主要是简单记录下. 利用脚本Github传送地址 ,后面的参考链接 ...
- Java注解Annotation详解
从JDK5开始,Java增加了Annotation(注解),Annotation是代码里的特殊标记,这些标记可以在编译.类加载.运行时被读取,并执行相应的处理.通过使用Annotation,开发人员可 ...
- 《Java并发编程》之线程中断与终止线程运行
Java中启动一个线程很容易,通常情况下我们都是等到任务运行结束后让线程自行停止.但有时需要在任务正在运行时取消他们,使得线程快速结束.对此Java并没有提供任何机制.但是我们可以通过Java提供的线 ...
- 4. 跟踪标记 (Trace Flag) 610 对索引组织表(IOT)最小化日志
跟踪标记:610 功能: 用批量导入操作(Bulk Import Operations)加载数据时,对于索引组织表(即有聚集索引的表) 最小化日志: 上图为simple/bulk-logged恢复模式 ...
- 一次php涉及跨域功能的麻烦及解决方案
一,功能及描述 1,在后台管理网站(php)admin.xxx.com(以下简称admin),上拉取并编辑aaa.xxx.com(php,以下简称aaa)上的图片及文件 2,file_get_cont ...
- webpack之前端性能优化(史上最全,不断更新中。。。)
最近在用webpack优化首屏加载性能,通过几种插件之后我们上线前后的速度快了一倍,在此就简单的分享下吧,先上个优化前后首屏渲染的对比图. 可以看到总下载时间从3800ms缩短到1600ms. 我们在 ...
- python中函数的参数解析
python中函数的各种参数梳理: 1.形参:函数定义时传入的参数 2.实参:函数调用时传入的参数 (有形参必传实参,形参里自身特点可不传的,可传可不传) 3.缺省参数:不传为默认值,传了会覆盖(下面 ...
- 【架构篇】OCP和依赖注入
描述 本篇文章主要讲解 : (1)OO设计OCP原则: (2)依赖注入引入 (3)依赖注入分析 (4)依赖注入种类 1 内容区 1.1 IOC背景 (1)Ralph E. Johnson &a ...
- 学习爬虫的day02 (用线程去爬虫 提高速度)
通过lxml的方式去分析数据,将爬到的数据放到file中的html中代码如下# 用线程去爬虫 from urllib.request import Request from urllib.reques ...