dcsimg
Newbie question: pre-loading tables for use in selectbox options.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kent_Vickery
Posted On:   Wednesday, February 27, 2002 11:08 PM

I am developing a database searching application using the struts framework. There is no main entry or login page (index.jsp) - there are a few struts/jsp pages that are linked to from a menu page outside this application (non-struts, different server). As an example, from my outside menu page (html) I might have a link to SearchClient.jsp. SearchClient.jsp has some search boxes (name, city, country, etc.). I want to have the options in the country selectbox populated from a database. My question is, under struts, what is the right way to do this, since my SearchClient.jsp page is not being triggered via a *.do actionmapping? Or should the menu page actually be part of the struts application, and use actionmappings to trigg   More>>

I am developing a database searching application using the struts framework. There is no main entry or login page (index.jsp) - there are a few struts/jsp pages that are linked to from a menu page outside this application (non-struts, different server).

As an example, from my outside menu page (html) I might have a link to SearchClient.jsp. SearchClient.jsp has some search boxes (name, city, country, etc.). I want to have the options in the country selectbox populated from a database.

My question is, under struts, what is the right way to do this, since my SearchClient.jsp page is not being triggered via a *.do actionmapping?

Or should the menu page actually be part of the struts application, and use actionmappings to trigger the loading of my selectbox values from the database before bring up the search request pages? There are reason for keeping the calling menu page separate from the struts application, so I would prefer to keep it this way if possible.

Thanks in advance. If there are any examples of search applications like this I would love to see them.

   <<Less

Re: Newbie question: pre-loading tables for use in selectbox options.

Posted By:   Ted_Husted  
Posted On:   Saturday, March 2, 2002 09:53 PM


The usual approach is to pass through an Action first, and
place the object in the request.



If these are static elements, they can also be placed in the
users session, or even in the application context, so that
they are always available.



Otherwise, you would have to conduct the database
query and create the bean on the JSP. This is a Model 1
approach and generally not recommended, but there is
nothing to prevent you from doing it. The

Jakarta Taglibs

project has a number of handy tags for database access.



-Ted

About | Sitemap | Contact