This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Struts and the fly likes Need to retrieve values from database on page loads. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Need to retrieve values from database on page loads." Watch "Need to retrieve values from database on page loads." New topic
Author

Need to retrieve values from database on page loads.

Prem Bhazee
Ranch Hand

Joined: Feb 18, 2006
Posts: 34
Hi Ranchers,

I am fairly new to struts. I need to retrieve values from a database when my home page is loaded.

Can I call my application url with databasevalues.do so this action class is called.


or I am not sure should I use Form submit in a JSP to pass action to the
/databasevalues and show the values from db to the same JSP like this

firstpage.jsp
<html:form action="/databasevalues " focus="name">
</html>



Thanks in advance
Bhazee
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It's all a question of when you need the values from the database. If you need them before the JSP is displayed, then you should call databasevalues.do as the URL. If you don't need them until after the form is submitted, then just make databasevalues the action for your form.


Merrill
Consultant, Sima Solutions
 
jQuery in Action, 2nd edition
 
subject: Need to retrieve values from database on page loads.