Hi,

I've modified the struts example to do a couple of things for me, but now i
want to add a main menu entry that will display a form which contains a
select box. This select box will contain the usernames of all the users in
the database.

I am a bit confused on how to approach building this. 

Here's what i've done so far:

I've created a class that extends Serializable named DatabaseList, which
contains a Users hashtable.

I've also created a DatabaseListForm class that extends ActionForm, and has
a getUsers() method which returns the hashtable of users.

In the struts-config.xml file, i've added the following to the form bean and
action mappings definitions:

 <!-- Database list form bean -->
    <form-bean      name="databaseListForm"
 
type="org.apache.struts.webapp.example.DatabaseListForm"/>

<!-- View database list -->
    <action    path="/viewDatabase"
               type="org.apache.struts.webapp.example.ViewDatabaseAction"
               name="databaseListForm"
              scope="request"
           validate="false">
      <forward name="success"              path="/database.jsp"/>
    </action>

Finally, i have to builtd my ViewDatabaseAction which extends Action, and i
presume that this is supposed to populate DatabaseListForm using the
DatabaseServlet class that was supplied with the example. This is where I
get confused. I have a getUsers() method in my DatabaseServlet which returns
an array of users. How do I populate my list of users in the
DatabaseListForm, can i use my getUsers() method or do I have to use
something else ?

Also, is it a good idea to have a hashtable of all users as opposed to an
array or a vector of just the usernames ?

Any help or any reference to something similar will be greatly appreciated.

Thank you,
      Corneliu

-------------
: Espial Inc.
: espial.com



Reply via email to