Avatar of ashok Priyadarshan
ashok Priyadarshan
 asked on

javax.el.PropertyNotFoundException: Property

I added a new value to my  home.jsp - jobtitle.
I added a new private string to my class containing jobtitle with setters and getters
I added the jobtitle to my impl: aContact.setJobTitle(rs.getString("jobtitle"));

the home.jsp is returning a 500 error.

HTTP Status 500 – Internal Server Error
Type Exception Report

Message An exception occurred processing JSP page [/WEB-INF/views/home.jsp] at line [28]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: An exception occurred processing JSP page [/WEB-INF/views/home.jsp] at line [28]

25:                     <tr>
26:                           <td>${status.index + 1}</td>
27:                               <td>${contact.name}</td>
28:                               <td>${contact.jobtitle}</td>
29:                               <td>${contact.email}</td>
30:                               <td>${contact.address}</td>
31:                               <td>${contact.telephone}</td>


Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:584)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

javax.el.PropertyNotFoundException: Property [jobtitle] not found on type [net.codejava.spring.model.Contact]
      javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:260)
      javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:212)
      javax.el.BeanELResolver.property(BeanELResolver.java:347)
      javax.el.BeanELResolver.getValue(BeanELResolver.java:92)
      org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
      org.apache.el.parser.AstValue.getValue(AstValue.java:169)
      org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
      org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
      org.apache.jsp.WEB_002dINF.views.home_jsp._jspx_meth_c_005fforEach_005f0(home_jsp.java:202)
      org.apache.jsp.WEB_002dINF.views.home_jsp._jspService(home_jsp.java:143)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/8.5.31


I haave enclosed the server log and he source code.

I need a quick fix
JSP* Spring Framework

Avatar of undefined
Last Comment
ashok Priyadarshan

8/22/2022 - Mon
ashok Priyadarshan

ASKER
I have enclosed the listing of the classes in the war file
girionis

Can you post your net.codejava.spring.model.Contact? Maybe the jobtitle is defined with camel case, so you need

<td>${contact.jobTitle}</td>
ashok Priyadarshan

ASKER
I have enclosed the class and the home.jsp and the error...


package net.codejava.spring.model;

public class Contact {
      private int id;
      private String name;
      private String JobTitle;
      private String email;
      private String address;
      private String telephone;

      public Contact() {
      }

      public Contact(String name, String JobTitle, String email, String address, String telephone) {
            this.name = name;
            this.JobTitle = JobTitle;
            this.email = email;
            this.address = address;
            this.telephone = telephone;
      }
      
      
      
            

      public int getId() {
            return id;
      }

      public void setId(int id) {
            this.id = id;
      }

      public String getName() {
            return name;
      }

      public void setName(String name) {
            this.name = name;
      }

      public String getEmail() {
            return email;
      }

      public void setEmail(String email) {
            this.email = email;
      }

      public String getAddress() {
            return address;
      }

      public void setAddress(String address) {
            this.address = address;
      }

      public String getTelephone() {
            return telephone;
      }

      public void setTelephone(String telephone) {
            this.telephone = telephone;
      }

      public String getJobTitle() {
            return JobTitle;
      }

      public void setJobTitle(String jobTitle) {
            JobTitle = jobTitle;
      }

}
==================================
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Applicant Manager</title>
    </head>
    <body>
          <div align="center">
              <h1>Applicant List</h1>
              <h3><a href="newContact">Applicant</a></h3>
              <table border="1">
                    <th>No</th>
                    <th>Name</th>
                    <th>JobTitle</th>
                    <th>Email</th>
                    <th>Address</th>
                    <th>Telephone</th>
                    <th>Action</th>
                    
                        <c:forEach var="contact" items="${listContact}" varStatus="status">
                    <tr>
                          <td>${status.index + 1}</td>
                              <td>${contact.name}</td>
                              <td>${contact.JobTitle}</td>
                              <td>${contact.email}</td>
                              <td>${contact.address}</td>
                              <td>${contact.telephone}</td>
                              <td>
                                    <a href="editContact?id=${contact.id}">Edit</a>
                                    &nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="deleteContact?id=${contact.id}">Delete</a>
                              </td>
                                          
                    </tr>
                        </c:forEach>                    
                  </table>
          </div>
    </body>
</html>



=====================================
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <display-name>SpringMvcJdbcTemplate</display-name>
      <context-param>
            <param-name>contextClass</param-name>
            <param-value>
                  org.springframework.web.context.support.AnnotationConfigWebApplicationContext
            </param-value>
      </context-param>
      <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>

      <servlet>
            <servlet-name>SpringDispatcher</servlet-name>
            <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <init-param>
                  <param-name>contextClass</param-name>
                  <param-value>
                        org.springframework.web.context.support.AnnotationConfigWebApplicationContext
                  </param-value>
            </init-param>
            <init-param>
                  <param-name>contextConfigLocation</param-name>
                  <param-value>net.codejava.spring</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
            <servlet-name>SpringDispatcher</servlet-name>
            <url-pattern>/</url-pattern>
      </servlet-mapping>

      <session-config>
            <session-timeout>30</session-timeout>
      </session-config>
</web-app>

=============================================================
error
HTTP Status 500 – Internal Server Error
Type Exception Report

Message An exception occurred processing JSP page [/WEB-INF/views/home.jsp] at line [28]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: An exception occurred processing JSP page [/WEB-INF/views/home.jsp] at line [28]

25:                     <tr>
26:                           <td>${status.index + 1}</td>
27:                               <td>${contact.name}</td>
28:                               <td>${contact.JobTitle}</td>
29:                               <td>${contact.email}</td>
30:                               <td>${contact.address}</td>
31:                               <td>${contact.telephone}</td>


Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:584)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

javax.el.PropertyNotFoundException: Property [JobTitle] not found on type [net.codejava.spring.model.Contact]
      javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:260)
      javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:212)
      javax.el.BeanELResolver.property(BeanELResolver.java:347)
      javax.el.BeanELResolver.getValue(BeanELResolver.java:92)
      org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
      org.apache.el.parser.AstValue.getValue(AstValue.java:169)
      org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
      org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)
      org.apache.jsp.WEB_002dINF.views.home_jsp._jspx_meth_c_005fforEach_005f0(home_jsp.java:202)
      org.apache.jsp.WEB_002dINF.views.home_jsp._jspService(home_jsp.java:143)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:443)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.

Apache Tomcat/8.5.31
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
rrz

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ashok Priyadarshan

ASKER
I need some help in solving this. looks simple but I am stuck
rrz

Did you see my first comment?
ashok Priyadarshan

ASKER
Yes it works.....

private String jobtitle;

I spent a day on this...

changed setters and getters and in the dao impl and voila it works. I would have never imagined this solution. The have to  remedy this because people define class variable in all cases...JobTitle. jobtitle. JOBTITLE etc...
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.