The moose likes Struts and the fly likes onLoad in DispatchAction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "onLoad in DispatchAction" Watch "onLoad in DispatchAction" New topic

onLoad in DispatchAction

ishan dave
Ranch Hand

Joined: Apr 16, 2007
Posts: 39
Dear All,

I am having a jsp page menupage.jsp now in this page I am having three links
1. Category
2. Sub Category
3. Item
for desplay of this linke i use <html:link> tag.

now when some one clicks on Category link the category.jsp page should be desplayed. At here my problamse starts. In this page I want to desplay all the existing categories in a drop down menu. I write the code for fatching the values of category from database. But i cant get any idea for showing all these categories in a drop down as the page is load. for solving this i try to use onLoad method in MyDispatchAction but it won't work. So anybody please guide me for populating the valuis in a drop down befor the page is submited I mean as user see the page first time it should be with all the category values.

Thanking you,
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Just create a new action named something like PrepareMenu and put logic in this action to retrieve the categories and put them either in the ActionForm bean or in request scope and forward to the menupage JSP. Then, instead of using the URL /MyApp/menupage.jsp to display the page, use the URL /MyApp/
[ August 28, 2007: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
I agree. Here's the link:
subject: onLoad in DispatchAction
It's not a secret anymore!