javax.el.PropertyNotFoundException: Property 'tname' not found on type java.lang.String

你离开我真会死。 提交于 2019-12-06 11:32:16

I think you are adding the names and the fee directly to the arraylist, but you should be adding the whole regForm object in the arraylist.

Instead of the below code

myBeans.add(reg.getTname());
myBeans.add(reg.getTfee());

you need to do like

myBeans.add(reg);

moreover dont use the same object that you got from the form. Try to create new objects and add in the arraylist and try to use generics.

EDIT:

while (rs.next()) {
        String testname = rs.getString("tname");
        String testfee = rs.getString("tfee");
        regForm beanObject = new regForm();
        beanObject.setTname(testname);
        beanObject.setTfee(testfee);
        myBeans.add(beanObject);
    }

Actually you are adding strings in your Collection and you are trying to invoke

getTName() by ${reg.tname}

Either add whole bean to your collection or just replace JSTL with ${reg}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!