aspose file tools*
The moose likes Struts and the fly likes displaying 2 datagrids so as to avoid NullPointerException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "displaying 2 datagrids so as to avoid NullPointerException" Watch "displaying 2 datagrids so as to avoid NullPointerException" New topic
Author

displaying 2 datagrids so as to avoid NullPointerException

Andrew Para
Greenhorn

Joined: Aug 20, 2009
Posts: 8
hello

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.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

"para para", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: displaying 2 datagrids so as to avoid NullPointerException