• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem displaying database table data in jsp form

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, (hope this is a jsp question.)

I'm using mvc architecture, and i have created one jsp which list the all data of my database table.

following is my Servlet which will call the model.java's funtion which returns ArrayList contaning all the data and than servlet forwards ArrayList to my JSP

ControllerServlet.java code


Model.java



and following is my jsp code which disply my database table data... which is in arraylist



The problem i'm facing is when my jsp get rendered my contactList is null, is there any way out to overcome this problem. And if i'm using wrong technique than what is the right way to display table data ???

Looking for standard/genuine solution...
[ March 23, 2007: Message edited by: Bear Bibeault ]
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thinking! is this the right way to do in JSP?
[ March 23, 2007: Message edited by: Saif uddin ]
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure,

need some more hint..
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that your query fired on the database server returns any records?

The following:

will just skip the loop if no results are fetched in the query. No exception is thrown if the resultset is empty.

Instead, have the following logic:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic