javax.el.PropertyNotFoundException: Property 'XXX' not found on type xx.xx.xx.xx problem solving (el expression))

When I was writing javawebthe project, I encountered javax.el.PropertyNotFoundException: Property 'XXX' not found on type xx.xx.xx.xxan error report, which troubled me for a long time, and I finally found out the solution after searching a lot of information.

Error:


javax.el.PropertyNotFoundException: 在类型 [com.chiaki.book.bean.Contract] 上未找到属性 [ConLandlord]
	javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:249)
	javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:201)
	javax.el.BeanELResolver.property(BeanELResolver.java:322)
	javax.el.BeanELResolver.getValue(BeanELResolver.java:83)
	org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:124)
	org.apache.el.parser.AstValue.getValue(AstValue.java:168)
	org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
	org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:692)
	org.apache.jsp.contract_005flist_jsp._jspx_meth_c_005fforEach_005f0(contract_005flist_jsp.java:308)
	org.apache.jsp.contract_005flist_jsp._jspService(contract_005flist_jsp.java:199)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	com.enjoy.book.filter.UserLoginFilter.doFilter(UserLoginFilter.java:30)

The corresponding attribute is named as ConLandlord, using the camel case naming method, but in fact, the el expression cannot detect such a naming, and should be changed to all lowercase letters.

After the modification, it is still invalid, and there may be other reasons

insert image description here
After testing, it was found that beanthe attribute classes in the code need to be regenerated idea, getterand setterthere are toStringmethods.
This is because the method was automatically generated by idea at the beginning. After we modified the attribute, the name of the method did not change, resulting in the recognition error.

Attachment: It is also possible that the format is wrong:

The standard el expression is as follows:

<c:forEach items="${列名}" var="mgr">
	    <option value="${mrg.emId }">${mgr.realName}</option>
</c:forEach>

Note that it is likely to be missing ${}, or the format is wrong

Guess you like

Origin blog.csdn.net/qq_51594676/article/details/126789754