• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Struts-layouts

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to add,edit,update the data present in my jsp using struts-layout datagrid tag.
The following is my code:
Methods to edit and update in action class are:



This is my Action form:





I am getting datagrid correctly. The problem is when i press Add button new row is added to the grid but when i click on save button that row is not saved.
As mentioned above i am using getAddedData() to get the added data which returns collection. But iam getting empty collection.
I am not getting the values from the

[AG: added code tags]
 
Marshal
Posts: 67335
171
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"user test", please check your private messages for an important administrative matter.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,

I am trying to display Data Grid in my JSP but i am getting following error

exception org.apache.jasper.JasperException: An exception occurred processing JSP page /FinanceJSPs/datagrid.jsp at line 12 9: <layout:html> 10: <layout:form action="/datagrid.do" width="60%" align="center" reqCode="update" styleClass="PANEL"> 11: <layout:row> 12: <layout:datagrid property="datagrid" selectionAllowed="true" multipleSelectionAllowed="false" model="datagrid"> 13: <layout:datagridColumn title="Student Name" property="stuname"/> 14: <layout:datagridColumn title="Father Name" property="fathername"/> 15: <layout:datagridColumn title="Application Number" property="appno"/> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) root cause java.lang.NullPointerException fr.improve.struts.taglib.layout.collection.CollectionsIterator.<init>(CollectionsIterator.java:35) fr.improve.struts.taglib.layout.collection.BaseCollectionTag.doStartLayoutTag(BaseCollectionTag.java:994) fr.improve.struts.taglib.layout.datagrid.DatagridTag.doStartLayoutTag(DatagridTag.java:57) fr.improve.struts.taglib.layout.BodyLayoutTagSupport.doStartTag(BodyLayoutTagSupport.java:36) org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005fdatagrid_005f0(datagrid_jsp.java:232) org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005frow_005f0(datagrid_jsp.java:199) org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005fform_005f0(datagrid_jsp.java:162) org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005fhtml_005f0(datagrid_jsp.java:122) org.apache.jsp.FinanceJSPs.datagrid_jsp._jspService(datagrid_jsp.java:93) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

This is my JSP:
.
I am having urgent requirement about this.
 
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajesh V, please check your private messages for some administrative matter.
 
Ankit Garg
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajesh, have you looked at this tutorial which might help you in understanding what you are doing wrong. Showing us the JSP page might also be a good idea as you might have done a mistake somewhere in there. Bala try to start a different topic for your problems in the future. I can see a root cause java.lang.NullPointerException in the stack trace. Can you check if the list you are trying to iterate over is null...
 
Bala Ranch
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ankit,
I thought Rajesh is going to give the JSP file what he developed but he never responded.
I am able to fetch the data from the database into the vector object then after I am doing all the datagrid values setup and DAO class setup
then also i am getting the same error.
This is my Tomcat log file Error log

Sep 2, 2009 11:27:22 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at fr.improve.struts.taglib.layout.collection.CollectionsIterator.<init>(CollectionsIterator.java:35)
at fr.improve.struts.taglib.layout.collection.BaseCollectionTag.doStartLayoutTag(BaseCollectionTag.java:994)
at fr.improve.struts.taglib.layout.datagrid.DatagridTag.doStartLayoutTag(DatagridTag.java:57)
at fr.improve.struts.taglib.layout.BodyLayoutTagSupport.doStartTag(BodyLayoutTagSupport.java:36)
at org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005fdatagrid_005f0(datagrid_jsp.java:229)
at org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005frow_005f0(datagrid_jsp.java:196)
at org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005fform_005f0(datagrid_jsp.java:159)
at org.apache.jsp.FinanceJSPs.datagrid_jsp._jspx_meth_layout_005fhtml_005f0(datagrid_jsp.java:119)
at org.apache.jsp.FinanceJSPs.datagrid_jsp._jspService(datagrid_jsp.java:90)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

.

This is my Action where i am fetching the data from the database and setting into datagrid.


Waiting for your response.
Thanks in advance.
 
Ankit Garg
Sheriff
Posts: 9643
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bala are you sure this is the correct code for your action. In the loop you are setting admdao to null, so you'll get a NullPointerException during the second iteration. Also I'm a little confused about NewAdmissionDao class, is it a POJO and DAO at the same time?? Does it have the stuname, fathername and appno properties??
 
We don't have time for this. We've gotta save the moon! Or check this out:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!