java - Iterating over an ArrayList which contains Bean objects with c:foreach,doesn't work -
i'm iterating on arraylist in jsp, contains objects of bean.i want use getter() extract information object.productid 1 of attribute i'm interested in. i'm using jstl purpose.the code follows:
<c:foreach items="repo" var="element"> <jsp:usebean id="element" scope="page" class="com.responsebean"/> product:<jsp:getproperty property="productid" name="element"/> </c:foreach>
where repo arraylist contains objects of responsebean.
list<responsebean> repo=new arraylist<responsebean>(10);
code of responsebean follows:
public class responsebean implements java.io.serializable { private static final long serialversionuid = 1l; private string productid; public string getproductid() { return productid; } public void setproductid(string productid) { productid = productid; }
but i'm getting following excepion
http status 500 - cannot find information on property 'productid' in bean of type 'com.responsebean' type exception report message cannot find information on property 'productid' in bean of type 'com.responsebean' description server encountered internal error prevented fulfilling request. exception org.apache.jasper.jasperexception: cannot find information on property 'productid' in bean of type 'com.responsebean' org.apache.jasper.runtime.jspruntimelibrary.getreadmethod(jspruntimelibrary.java:824) org.apache.jasper.compiler.generator$generatevisitor.visit(generator.java:1081) org.apache.jasper.compiler.node$getproperty.accept(node.java:1125) org.apache.jasper.compiler.node$nodes.visit(node.java:2375) org.apache.jasper.compiler.node$visitor.visitbody(node.java:2427) org.apache.jasper.compiler.generator$generatevisitor.visit(generator.java:1784) org.apache.jasper.compiler.node$customtag.accept(node.java:1538) org.apache.jasper.compiler.node$nodes.visit(node.java:2375) org.apache.jasper.compiler.node$visitor.visitbody(node.java:2427) org.apache.jasper.compiler.node$visitor.visit(node.java:2433) org.apache.jasper.compiler.node$root.accept(node.java:474) org.apache.jasper.compiler.node$nodes.visit(node.java:2375) org.apache.jasper.compiler.generator.generate(generator.java:3517) org.apache.jasper.compiler.compiler.generatejava(compiler.java:250) org.apache.jasper.compiler.compiler.compile(compiler.java:373) org.apache.jasper.compiler.compiler.compile(compiler.java:353) org.apache.jasper.compiler.compiler.compile(compiler.java:340) org.apache.jasper.jspcompilationcontext.compile(jspcompilationcontext.java:657) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:357) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:727) org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) note full stack trace of root cause available in apache tomcat/7.0.52 logs. apache tomcat/7.0.52
where going wrong?
you not need this, can use el
<c:foreach items="repo" var="element"> product: ${element.productid} </c:foreach>
Comments
Post a Comment