I'm currently working on a user management system with struts, hibernate and mysql.
I'm new to Hibernate, but what I want to do is the following:
When the administrator is creating a user, he has to select the company of the user from a combobox in the userform.
I've two tables: useraccount and company
So, the user has to be saved with the proper companyID.
I've this code in my createUser.jsp:
Code:
<html:select property="company" size="1">
<html:option key="users.noselection" value=""/>
<html:optionsCollection property="companyID" value="companyID" label="companyName"/>
</html:select>
But no combobox or list is seen...
I've got a CompanyBean, with all accessor methods of the company-table. And in the UserAccountBean, I've an getCompany, setCompany method.
I've got this code in my UserAccount.hbm.xml
Code:
<set name="company" table="COMPANY">
<key column="companyID"/>
<many-to-one name="company"
class="Company"
column="companyID"/>
</set>
In my Company.hbm.xml, I've the properties of the CompanyBean.
So, How could I list all the company's in a combobox? And when I've one selected, save the companyID in my UserAccount table????
Thanks for all your help!!!!