Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By Tolls

Thread: javax.servlet.ServletException: javax.el.PropertyNotFoundException:

  1. #1
    AAKJAVA is offline Member
    Join Date
    Feb 2012
    Posts
    1
    Rep Power
    0

    Default javax.servlet.ServletException: javax.el.PropertyNotFoundException:

    Hello:
    I am using JSTL custom tag example , using tag file, bean , and using tagfile in jsp
    I am getting below error in tag file when i am trying to access bean with ${beanid.property}


    ================================================== ================================================
    HTTP Status 500 -

    type Exception report

    message

    descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

    exception

    javax.servlet.ServletException: javax.el.PropertyNotFoundException: The class 'JEE.AddressBean' does not have the property 'Line1'.

    root cause

    javax.el.PropertyNotFoundException: The class 'JEE.AddressBean' does not have the property 'Line1'

    ================================================== ================================================== ==

    sources

    1. Define AddressBean with following properties having set and get methods
    private String AddressType;
    private String Line1;
    private String Line2;
    private String City;
    private String State;
    private String Zip;

    2. Custom Tag
    <%@tag description="put the tag description here" pageEncoding="UTF-8"%>
    <%@attribute name="addressType" required="true" %>
    <jsp:useBean id="addressBean" scope="session" class="JEE.AddressBean" />

    <table cellpading="0" cellspacing="0" border="0">
    <tr>
    <td>Line 1:&nbsp;</td>
    <td>
    <input type="text" size="20"
    name="${addressType}_Line1"
    id="${addressType}_Line1"
    value="${addressBean.Line1}"/> // getting runtime error here, even though //
    </td>
    </tr>
    <tr>
    <td>Line 2:&nbsp;</td>
    <td
    <input type="text" size="20"
    name="${addressType}_Line2"
    id="${addressType}_Line2"
    value="${addressBean.Line2}" />
    </td>
    </tr>
    <tr>
    <td>City:&nbsp;</td>
    <td
    <input type="text" size="20"
    name="${addressType}_City"
    id="${addressType}_City"
    value="${addressBean.City}" />
    </td>
    </tr>
    <tr>
    <td>State:&nbsp;</td>
    <td>
    <select name="${addressType}_State"
    id="${addressType}_State}">
    <option value="AL"
    <c:if test="${addressBean.State == 'AL' }">
    selected</c:if>>Alabama
    </option>
    <option value="AK"
    <c:if test="${addressBean.State == 'AK' }">
    selected</c:if>>Alaska
    </option>
    <option value="AZ"
    <c:if test="${addressBean.State == 'AZ' }">
    selected</c:if>>Arizona
    </option>
    <option value="AR"
    <c:if test="${addressBean.State == 'AR' }">
    selected</c:if>>Arkansas
    </option>
    <option value="CA"
    <c:if test="${addressBean.State == 'CA' }">
    selected</c:if>>California
    </option>
    </select>
    </td>
    </tr>
    <tr>
    <td>Zip:&nbsp;</td>
    <td>
    <input type="text"
    name="${addressBean}_Zip"
    id="${addressBean}.Zip}"
    value="${addressBeab.Zip}" />
    </td>
    </tr>
    </table>
    <%-- any content can be specified here e.g.: --%>
    <h2>${message}</h2>


    3. using tag file and addition html
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <%@taglib prefix="ct" tagdir="/WEB-INF/tags/" %>
    <%@page import="JEE.AddressBean" %>

    <%

    AddressBean addressBean = new AddressBean();
    addressBean.setAddressType("home");
    addressBean.setLine1("123 Tennis Court");
    addressBean.setLine2("s.v.road");
    addressBean.setCity("Phoneix");
    addressBean.setState("AZ");
    addressBean.setZip("85001");
    session.setAttribute("addressBean", addressBean);

    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h1>Hello World!</h1>
    <form>
    <ct:address addressType="home"/>
    <table cellingpadding="0" cellspacing="0" border="0" >
    <tr>
    <td style="width:65px;"></td>
    <td>

    </td>

    </td>
    </tr>

    </table>

    </form>
    </body>
    </html>


    please help me out .

    THANKS IN ADVANCE

    REGARDS
    AAK

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,956
    Rep Power
    19

    Default Re: javax.servlet.ServletException: javax.el.PropertyNotFoundException:

    Your AddressBean does not follow Bean naming standards.
    The attributes of a bean should not start with a capital letter.
    DarrylBurke likes this.

Similar Threads

  1. Replies: 1
    Last Post: 08-23-2011, 11:12 AM
  2. Replies: 1
    Last Post: 06-21-2011, 12:50 PM
  3. javax.servlet.ServletException:Can't get definitions factory
    By Peter in forum JavaServer Faces (JSF)
    Replies: 3
    Last Post: 12-02-2008, 07:29 AM
  4. javax.servlet.ServletException: No collection found
    By pushpendra21only in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 11-18-2008, 08:07 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •