即使在jsp的类中也找不到该属性

时间:2020-07-14 01:20:31

标签: java spring jsp servlets

我需要有关jsp中的PropertyNotFound异常的帮助:

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

这是我的jsp文件:

<%@ 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代码:

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;
    }

    }
}

我寻找了解决方法,但没有成功。我已经正确定义了setter和getter,但是由于某种原因,它无法正常工作。任何人都可以指出这里出了什么问题吗?

谢谢

0 个答案:

没有答案