O
Oleg Konovalov
Hi,
I am relatively new to Struts [using 1.3].
I need to create a form using Struts tag libs with 2 HTML select's [lists],
connected to 2 DB tables, say allUsers and Admins, which would allow
to select Administrators from the list of AllUsers.
So I will have 3 buttons: Add, Remove and Update.
Add - to add selected item(s) from AllUsers list to Admins list [if it is
not there already];
Remove- to delete selected item(s) from Admins list;
Update - to save changes to Admins list to the Admins DB table.
So roughly my JSP will looks something like that:
<%@ page import="java.util.Collection" %>
<html:form property="manageAdmins" action="/manageAdmins">
<table>
<tr>
<td> </td>
<td>All Users:</td>
<td> </td>
<td> </td>
<td> </td>
<td>Administrators:</td>
</tr>
<tr>
<td> </td>
<td>
<html:select size="8" property="allUsers" multiple="true"
styleId="allUsersID">
<htmlptions collection="AllUsersList" property="AllUsersId"
labelProperty="allUsers"/>
</html:select>
</td>
<td> </td>
<td>
<table>
<tr><img src="/images/btn_add.gif" alt="Add" name="add" border="0"
id="add" onClick="?">
</tr>
<tr><img src="/images/btn_remove.gif" alt="Remove" name="remove"
id="remove" onClick="?">
</tr>
<tr><img src="/images/btn_update.gif" alt="Update" name="update"
id="update" onClick="?">
</tr>
</table>
</td>
<td> </td>
<td>
<html:select size="8" property="admins" multiple="true"
styleId="adminsID" onchange="getAdmins();">
<htmlptions collection="AdminsList" property="AdminID"
labelProperty="admins"/>
</html:select>
</td>
</tr>
<tr>
</tr>
</table>
</html:form>
So how do I manipulate these <htmlptions collection=AdminList...> Struts
tags
in order to implement Add, Remove, Update ? In onClick="..." ?
Is it in JavaScript or in Java ?
Any other useful Struts tags for that [especially to do DB synchronization]?
Code snippets ?
Sorry for the newbie question.
Thank you in advance,
Oleg.
A
I am relatively new to Struts [using 1.3].
I need to create a form using Struts tag libs with 2 HTML select's [lists],
connected to 2 DB tables, say allUsers and Admins, which would allow
to select Administrators from the list of AllUsers.
So I will have 3 buttons: Add, Remove and Update.
Add - to add selected item(s) from AllUsers list to Admins list [if it is
not there already];
Remove- to delete selected item(s) from Admins list;
Update - to save changes to Admins list to the Admins DB table.
So roughly my JSP will looks something like that:
<%@ page import="java.util.Collection" %>
<html:form property="manageAdmins" action="/manageAdmins">
<table>
<tr>
<td> </td>
<td>All Users:</td>
<td> </td>
<td> </td>
<td> </td>
<td>Administrators:</td>
</tr>
<tr>
<td> </td>
<td>
<html:select size="8" property="allUsers" multiple="true"
styleId="allUsersID">
<htmlptions collection="AllUsersList" property="AllUsersId"
labelProperty="allUsers"/>
</html:select>
</td>
<td> </td>
<td>
<table>
<tr><img src="/images/btn_add.gif" alt="Add" name="add" border="0"
id="add" onClick="?">
</tr>
<tr><img src="/images/btn_remove.gif" alt="Remove" name="remove"
id="remove" onClick="?">
</tr>
<tr><img src="/images/btn_update.gif" alt="Update" name="update"
id="update" onClick="?">
</tr>
</table>
</td>
<td> </td>
<td>
<html:select size="8" property="admins" multiple="true"
styleId="adminsID" onchange="getAdmins();">
<htmlptions collection="AdminsList" property="AdminID"
labelProperty="admins"/>
</html:select>
</td>
</tr>
<tr>
</tr>
</table>
</html:form>
So how do I manipulate these <htmlptions collection=AdminList...> Struts
tags
in order to implement Add, Remove, Update ? In onClick="..." ?
Is it in JavaScript or in Java ?
Any other useful Struts tags for that [especially to do DB synchronization]?
Code snippets ?
Sorry for the newbie question.
Thank you in advance,
Oleg.
A