Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get data from database when jsp page load

 
Alan Jeri
Greenhorn
Posts: 4
  • 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
  • Likes 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: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 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
  • 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: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
  • 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: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic