• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Mike London

displaying 2 datagrids so as to avoid NullPointerException

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am new to struts
I noticed that if I put a datagrid on a page say a.jsp and then I run the application and go to http://localhost:8080/myapp/a.jsp I get a NullPointer exception.
I guess this is logical because there isn't anything in the datagrid so I go to http://localhost:8080/myapp/a.do?reqCode=display instead and the function display in my DispatchAction gets fired populates the grid from the database and the data gets displayed and there is no more NullPointer exception.

But now I want to do this:
display one datagrid and when the user clicks something display another.

How can I do this without getting another NullPointer exception? The data in the second datagrid depends on the user's action so it cannot be populated from the get-go. It will throw a NullPointer exception unless there is another way. Can't I tell a grid somehow: "if there is no data do not appear on the screen at all appear only when there is data"? This is what I am basically trying to do.

Please help. Thank you in advance.
Posts: 67695
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"para para", please check your private messages for an important administrative matter.
    Bookmark Topic Watch Topic
  • New Topic