javax.el.PropertyNotFoundExceptionProperty 'Tid' not found on type com.msz.sims.domain.Teacher
来源:互联网 发布:淘宝卖家客服态度恶劣 编辑:程序博客网 时间:2024/06/01 21:57
不知道大家与没有遇到类似的问题
以下分类讨论:
Teacher:
public class Teacher {
private int Tid;//注意到Tid的第一个字母是大写,这里是关键哦
省略getters和setters。。。
}
Action:
public String execute() {
Map request = (Map)ActionContext.getContext().get("request");
request.put("teacherInfo",TService.listAll(Teacher.class));
return "success";
}
//注释TService.listAll(Teacher.class)的返回值是一个List,里面存放的是若干Teacher对象
jsp:ognl & jstl
<s:iterator value="#request.teacherInfo" id="teacher">
<tr>
<td>
<s:property value="#teacher.Tid" />
</td>
</tr>
</s:iterator>
<c:forEach var="ts" items="${request.teacherInfo}">
${ts.tid}
</c:forEach>
注意到区别没有?我们可以看到,ognl解析时,对Teacher类的Tid属性保存了原有的大小写规范,而jstl的解析方式就大不相同了,相信大家也注意到了
jstl会将Tid全转换为小写,所以必须用ts.tid而不是ts.Tid
从javabean的设计角度来说:根据 JavaBeans 规范,属性的前两个字母不能是一大一小,或者是一小一大。前两个字母只能全是小写,
或者全是大写字母(具体可见:http://blog.csdn.net/yunye114105/article/details/7364264)
在此提出只是做一个反面教材,希望大家能在以后的开发中注意,不要犯和我一样的错误
- javax.el.PropertyNotFoundExceptionProperty 'Tid' not found on type com.msz.sims.domain.Teacher
- javax.el.PropertyNotFoundExceptionProperty "name" not found on type java.lang.String
- he.jasper.JasperException: javax.el.PropertyNotFoundException: Property '0' not found on type com.jy
- javax.el.PropertyNotFoundException: Property 'Name' not found on type com.min.test.User
- javax.el.PropertyNotFoundException: Property 'StuNum' not found on type com.gzsy.xtw.model.tb_studen
- javax.el.PropertyNotFoundException: Property 'xxx' not found on type com.xxx.xxx
- javax.el.PropertyNotFoundException: Property 'xxx' not found on type
- javax.el.PropertyNotFoundException: Property 'XXX' not found on type XXX
- javax.el.PropertyNotFoundException: Property 'fyear' not found on type
- javax.el.PropertyNotFoundException: Property 'emailaddress' not found on type ja
- org.apache.jasper.JasperException: javax.el.ELException: Error reading 'name' on type com.ht.domain.
- EL表達式錯誤:javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String
- el表达式的一些小问题:javax.el.PropertyNotFoundException: Property 'Title' not found on type
- javax.el.PropertyNotFoundException: Property 'name' not found on type java.lang.String
- javax.el.PropertyNotFoundException: Property 'begin' not found on type java.lang.String
- javax.el.PropertyNotFoundException: Property 'key' not found on type java.lang.String
- javax.el.PropertyNotFoundException: Property 'id' not found on type java.lang.String
- javax.el.PropertyNotFoundException: Property 'id' not found on type java.lang.String
- 基于ARM核的芯片选择
- printf 输出彩色字体
- vsftpd 530 login incrrect 虚拟用户配置无法登陆问题处理
- 2010-09-21 12:11 jstl fmt:parseDate
- 图像金字塔
- javax.el.PropertyNotFoundExceptionProperty 'Tid' not found on type com.msz.sims.domain.Teacher
- 伤感女生空间日志-难舍难分的淡淡情愁
- 邻接表模版c+
- 云计算之 IaaS 详解
- 网络运营路测数据展示技术剖析之数据来源获取及投影
- Linux系统的NTFS驱动-NTFS-3g的安装和配置 - 方法综合
- thinkphp jquery剪切图片 Jcrop
- 今天研究安卓源码时遇到的中文乱码的问题
- 虾米男的伤感爱情日志推荐:我会忘记你,因为你不属于我