Question

I'm struggeling on this and I can't figure out why this error occurs.

I have a bean:

package mybeans;

import java.io.Serializable;

public class FrageAntwortListeBean implements Serializable {
    private static final long serialVersionUID = 1L;
    private String questions;

    public FrageAntwortListeBean() {
        this.questions = ""
    }

    public String toString() {
        return questions;
    }

    public String getQuestions() {
        return questions;
    }

    public void setQuestions(String questions) {
        this.questions = questions;
    }
}

So now I want to use this bean in a JSP:

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<jsp:useBean id="meineFragen" class="mybeans.FrageAntwortListeBean" scope="session"  />
<jsp:setProperty name="meineFragen" property="*" />
${meineFragen.questions}

And now it is firing this error: javax.el.PropertyNotFoundException: Property 'questions' not found on type mybeans.FrageAntwortListeBean

I have absolutely no clue, why this happens, because I never had this issue before... What am I doing wrong?? I simplified the example for just a string attribute, normally it looks more complex, but I get this error even with that simple structure! What am I doing wrong?

Even if I use a scriptlet, eclipse of course suggests me the function getQuestions() but when running the JSP it is showing a similar error.

<%= meineFragen.getQuestions() %>

If I import it via page directive and use the following it is working. BUT, scriptlets are ugly!

<%! FrageAntwortListeBean x = new FrageAntwortListeBean(); %>
<%= x.getQuestions() %>

I appreciate all help! :) Working with apache tomcat 7, did redeployment, cleaning it up, compiling everything new. Used a new installation. No chance!

Was it helpful?

Solution

So I solved this now. :) The issue was, that I used the built in eclipse function to generate new serialVersionUIDs... Well, i missclicked a couple of times and had now twice serialVersionUID = 1L

After changing it to for example serialVersionUID = -7497282229152922152L; it is not throwing that error anymore!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top