Note that there are some explanatory texts on larger screens.

plurals
  1. POKeep Receiving javax.el.PropertyNotFoundException: The class '...' does not have the property '...'
    primarykey
    data
    text
    <p>I am doing a project which searches a specific member from my database searching for his <strong>memberId</strong> and then show selected information, but <strong>I'm having trouble with my Java Class Setter</strong>(not really sure if it was really the problem) because I keep on receiving error message from the catch(Exception ex)</p> <p><strong>javax.el.PropertyNotFoundException: The class 'Project.Members' does not have the property 'FirstName'.</strong></p> <p>Can you help me figure out what was wrong with my code?</p> <p><strong>This is my servlet code:</strong></p> <pre><code>public class SearchAMember extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; String query = "SELECT memberId, FirstName FROM members WHERE memberId = ?"; try { out.println("&lt;html&gt;"); out.println("&lt;head&gt;"); out.println("&lt;title&gt;Servlet SelectDemo&lt;/title&gt;"); out.println("&lt;/head&gt;"); out.println("&lt;body&gt;"); try { Class.forName(Connect.DRIVER); con = DriverManager.getConnection(Connect.CONNECTION_STRING, Connect.USERNAME, Connect.PASSWORD); stmt = con.prepareStatement(query); int findId = Integer.parseInt(request.getParameter("id")); stmt.setInt(1, findId); rs = stmt.executeQuery(); Members std; if (rs.next()) { std = new Members(); std.setMemberId(rs.getInt("memberId")); std.setFirstName(rs.getString("FirstName")); request.setAttribute("Members", std); RequestDispatcher rd = request.getRequestDispatcher("/DisplayAllMembers.jsp"); rd.forward(request, response); } else { out.println("No record found..."); } } catch (ClassNotFoundException ex) { out.println("Driver not found..."); } catch (SQLException ex) { out.println("Failed connection or query...." + ex.getMessage()); } catch (Exception ex) { out.println("Error.... " + ex.getMessage()); } finally { try { con.close(); } catch (SQLException ex) { } } } finally { out.println("&lt;/body&gt;"); out.println("&lt;/html&gt;"); out.close(); } } /*&lt;--HttpServlet Method was here--&gt;*/ } </code></pre> <p>}</p> <p>and my <strong>Member.java</strong> class for my getter and setter:</p> <p>public class Members {</p> <pre><code>private int memberId; private String Username; private String Password; private String FirstName; private String MiddleName; private String LastName; private String Address; private String Email; private int CurrPoints; public String getAddress() { return Address; } public int getCurrPoints() { return CurrPoints; } public String getEmail() { return Email; } public String getFirstName() { return FirstName; } public String getLastName() { return LastName; } public String getMiddleName() { return MiddleName; } public String getPassword() { return Password; } public String getUsername() { return Username; } public int getMemberId() { return memberId; } public void setAddress(String Address) { this.Address = Address; } public void setCurrPoints(int CurrPoints) { this.CurrPoints = CurrPoints; } public void setEmail(String Email) { this.Email = Email; } public void setFirstName(String FirstName) { this.FirstName = FirstName; } public void setLastName(String LastName) { this.LastName = LastName; } public void setMiddleName(String MiddleName) { this.MiddleName = MiddleName; } public void setPassword(String Password) { this.Password = Password; } public void setUsername(String Username) { this.Username = Username; } public void setMemberId(int memberId) { this.memberId = memberId; } </code></pre> <p>}</p> <p>also this is my <strong>Jsp</strong>:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt;JSP Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Members Information&lt;/h1&gt; Id: ${Members.memberId}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name: ${Members.FirstName}&lt;br/&gt; &lt;/body&gt; </code></pre> <p></p> <p>Does the problem was at my <strong>Members.java</strong> class? I am really clueless what was wrong with it... please help...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload