This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes PageLoad event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "PageLoad event" Watch "PageLoad event" New topic
Author

PageLoad event

Java On
Greenhorn

Joined: Dec 16, 2008
Posts: 2
hi All,

i want to populate the drop down list from the database when page loads.
How to achieve the same in Struts2.0?
is there is any way to call certain action when page loads.

Thnx & Regards,
Abhi
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The Preparable interface may help.

http://struts.apache.org/2.x/docs/prepare-interceptor.html

Dave
Java On
Greenhorn

Joined: Dec 16, 2008
Posts: 2
hi,


interceptor are called on some action. But if the page is getting loaded from the browser first time, how to populate the drop down from database table as there is no action involved.
is there any solution apart from java scripting.

Thnx & Regrads,
Abhi
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

In general you shouldn't go to a JSP page directly--all pages should be reached through an action.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: PageLoad event
 
Similar Threads
dropdown from database
Browser Back Calling Action again
Javascript document object writes in a new page?
When will be a static block executed.
Auto focus on a text box after a key press