0

I need help with PropertyNotFound Exception in jsp:

SEVERE: Servlet.service() for servlet jsp threw exception
javax.el.PropertyNotFoundException: Property 'homepageImgLink' not found on type com.BannerReader

Here is my jsp file:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ng" uri="http://abc.xyz" %>
<jsp:useBean id="marketingBannerBean" class="com.BannerReader" />
        <div class="content">
            <ng:a href="${marketingBannerBean.homepageImgLink}"><ng:img src="${marketingBannerBean.homepageImgUrl}"/></ng:a>
        </div>

Java Code:

public class BannerReader extends DefaultRead
{   
    private static String homepageImgUrl = "";
    private static String homepageImgLink = "";

    protected Map doReadInternal(HttpSession session, Command command) throws PluginException
    {
        homepageImgUrl = (String)homepageBanner.get("url");    --- This is just reading from the config
        homepageImgLink = (String)homepageBanner.get("link");  -- This is reading from the config 
        
            // Home page 
    public String getHomepageImgUrl() {
        return this.homepageImgUrl;
    }

    public  void setHomepageImgUrl(String homepageImgUrl) {
        this.homepageImgUrl = homepageImgUrl;
    }

    public  String getHomepageImgLink() {
        return this.homepageImgLink;
    }

    public void setHomepageImgLink(String homepageImgLink) {
        this.homepageImgLink = homepageImgLink;
    }

    }
}

I looked over for the fix but no success. I have properly defined setter and getter but for some reason its not working. Can anyone please point out what's wrong here?

Thanks,

aak
  • 107
  • 1
  • 4
  • 12
  • Not sure, and it's been a long while since I've done any JSP, but your JSP class, `com.BannerReader`, doesn't seem to match your Java class, `MarketingBannerReader`. – markspace Jul 14 '20 at 01:49
  • Thanks for pointing out. It was a typo while writing it out here. – aak Jul 14 '20 at 02:24
  • But I’m still getting the same error – aak Jul 14 '20 at 05:43

0 Answers0