loops - JSP varStatus javax.el.PropertyNotFoundException: Property status is not found on type -
i'm having problem objects list index:
my jsp:
<c:choose> <c:when test="${empty findattributes}"> <h1 align="center">attributes empty</h1> </c:when> <c:otherwise> <table align="center" border="1" id="resulttable"> <c:foreach items="${findattributes}" var="findattributesvar" varstatus="status"> <tr> <td align="center">${findattributesvar.status.index.formdescriptionlist.status.status.institutions.nameofinstitution}</td> <td align="center">${findattributesvar.status.index.formdescriptionlist.status.status.institutiontype.typeofinstitution}</td> <td align="center">${findattributesvar.status.index.formdescriptionlist.dayschedule}</td> <td align="center">${findattributesvar.status.index.formdescriptionlist.workscheduale}</td> </tr> </c:foreach> </table> </c:otherwise> </c:choose>
i'm fetching attribute list findattributes
, try objects index in jsp page , similar java code like:
attributeslist.get(i).getformdescriptionlist().get(i).getinstitutions().getnameofinstitution()); attributeslist.get(i).getformdescriptionlist().get(i).getinstitutiontype().gettypeofinstitution(); attributeslist.get(i).getparticulardate().tostring()); attributeslist.get(i).getformdescriptionlist().get(i).getdayschedule()); attributeslist.get(i).getformdescriptionlist().get(i).getworkscheduale());
my stack trace error:
jul 26, 2013 4:57:18 pm org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet [appservlet] in context path [/web] threw exception [an exception occurred processing jsp page /web-inf/views/search.jsp @ line 141 138: <tr> 139: 140: <td align="center">${findattributesvar.particulardate}</td> 141: <td align="center">${findattributesvar.status.index.formdescriptionlist.dayschedule}</td> 142: <td align="center">${findattributesvar.status.index.formdescriptionlist.workscheduale}</td> 143: <td align="center">${findattributesvar.status.index.formdescriptionlist.rotation}</td> 144: <td align="center">${findattributesvar.status.index.formdescriptionlist.numberofkids}</td> stacktrace:] root cause javax.el.propertynotfoundexception: property 'status' not found on type edu.demidov.dto.formdate @ javax.el.beanelresolver$beanproperties.get(beanelresolver.java:223) @ javax.el.beanelresolver$beanproperties.access$400(beanelresolver.java:200) @ javax.el.beanelresolver.property(beanelresolver.java:311) @ javax.el.beanelresolver.getvalue(beanelresolver.java:85) @ javax.el.compositeelresolver.getvalue(compositeelresolver.java:67) @ org.apache.el.parser.astvalue.getvalue(astvalue.java:169) @ org.apache.el.valueexpressionimpl.getvalue(valueexpressionimpl.java:189) @ org.apache.jasper.runtime.pagecontextimpl.proprietaryevaluate(pagecontextimpl.java:985) @ org.apache.jsp.web_002dinf.views.search_jsp._jspx_meth_c_005fforeach_005f3(search_jsp.java:1157) @ org.apache.jsp.web_002dinf.views.search_jsp._jspx_meth_c_005fotherwise_005f0(search_jsp.java:790) @ org.apache.jsp.web_002dinf.views.search_jsp._jspx_meth_c_005fchoose_005f0(search_jsp.java:639) @ org.apache.jsp.web_002dinf.views.search_jsp._jspservice(search_jsp.java:222) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:722) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:419) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:391) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) @ javax.servlet.http.httpservlet.service(httpservlet.java:722) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:304) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.catalina.core.applicationdispatcher.invoke(applicationdispatcher.java:684) @ org.apache.catalina.core.applicationdispatcher.processrequest(applicationdispatcher.java:471) @ org.apache.catalina.core.applicationdispatcher.doforward(applicationdispatcher.java:402) @ org.apache.catalina.core.applicationdispatcher.forward(applicationdispatcher.java:329) @ org.springframework.web.servlet.view.internalresourceview.rendermergedoutputmodel(internalresourceview.java:238) @ org.springframework.web.servlet.view.abstractview.render(abstractview.java:263) @ org.springframework.web.servlet.dispatcherservlet.render(dispatcherservlet.java:1208) @ org.springframework.web.servlet.dispatcherservlet.processdispatchresult(dispatcherservlet.java:992) @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:939) @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:856) @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:936) @ org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:827) @ javax.servlet.http.httpservlet.service(httpservlet.java:621) @ org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:812) @ javax.servlet.http.httpservlet.service(httpservlet.java:722) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:304) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.springframework.web.filter.characterencodingfilter.dofilterinternal(characterencodingfilter.java:88) @ org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:243) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:240) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:164) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:462) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:164) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:100) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:562) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:118) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:395) @ org.apache.coyote.http11.http11processor.process(http11processor.java:250) @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:188) @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:302) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1110) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:603) @ java.lang.thread.run(thread.java:722)
my formdate entity:
package edu.demidov.dto;
@entity @table(name="form_date") public class formdate implements serializable{ private static final long serialversionuid = -6727012506326164775l; private int dateid; @id @generatedvalue(strategy= identity) @column(name="date_id") public int getdateid() { return dateid; } public void setdateid(int dateid) { this.dateid = dateid; } private int version; @version @column(name="version") public int getversion() { return version; } public void setversion(int version) { this.version = version; } private date particulardate; @column(name="particular_date") @datetimeformat(pattern="yyyy-mm-dd") @temporal(temporaltype.date) public date getparticulardate() { return particulardate; } public void setparticulardate(date particulardate) { this.particulardate = particulardate; } private list<formdescription> formdescriptionlist = new arraylist<formdescription>(); @onetomany(mappedby="formdate") @cascade(cascadetype.all) public list<formdescription> getformdescriptionlist() { return formdescriptionlist; } public void setformdescriptionlist(list<formdescription> formdescriptionlist) { this.formdescriptionlist = formdescriptionlist; } }
how it's create table c:foreach
nester in c:foreach
2 objects in attributes:
-=table=- |header1|header2|header3| ------------------------- |value1| value1 |value1 | ------------------------- |value2| value2 |value2 | ------------------------- |value1| value1 |value1 | ------------------------- |value2| value2 |value2 |
it seems want iterate on list of formdate
instances, , display each formdescription
of each formdate in list. need first loop:
${formdate.particulardate} here should list of formdescription of current formdate displayed
you don't need varstatus
loop, in java need
for (formdate formdate : findattributes) { system.out.println(formdate.getparticulardate()); system.out.println("here should list of formdescription of current formdate displayed"); }
without need index of current iteration.
to display list of formdescriptions, need loop:
for (formdate formdate : findattributes) { system.out.println(formdate.getparticulardate()); (formdescription description : formdate.getformdescriptionlist()) { system.out.println(" " + description.getdayschedule()); system.out.println(" " + description.getworkschedule()); } }
note once again, don't need index. in jsp, like
<c:foreach var="formdate" items="${findattributes}"> <tr> <td>${formdate.particulardate}</td> <td> <ul> <c:foreach var="description" items="${formdate.formdescriptionlist}> <li> ${description.dayschedule} - ${description.workschedule} </li> </c:foreach> </ul> </td> </tr>
of course, layout you. should idea of how iterate using c:foreach
.
Comments
Post a Comment