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.