Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get data from database when jsp page load

 
Alan Jeri
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to known how to get data from database when the jsp page first load on the WebServer,but I don't want to user JSTL tag
 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use the scriptlet tags i.e.
<% 'your Java Database connection and data fetching stuff here' %>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you follow modern web application best practices, this is the type of thing you'd do in the page controller servlet before the JSP is invoked.
 
Alan Jeri
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have start my project with struts2 + spring + hibernate ,
I don't want to use scriptlet ,because I think it is hard to vindicate.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, avoid scriptlets.

If you are using Struts, the pages prep action is the perfect place to delegate this type of activity.
 
Alan Jeri
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but I don't know how to go to the action when the jsp page first load,This is my problem
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You go to the action first.

Since this has become about Struts, I've moved it to the Struts forum.
 
Alan Jeri
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but Do it like this, look not very good ,thank you all the same!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic