multiple selection in jsp using struts

V

Vasu

Hi

I have a list box with multiple selected values that were selected when
a user was created for eg: . The scenario is when the user is selected,
these multiple selected values should be high lighted in the list.

jsp code
-----------------
<bean:define id="userProp" name="addUserForm"
property="userPropositions" />
<html:select property="selProposition" multiple="true"
name="addUserForm" onchange="showProposition()">
<logic:equal name="userProp" property="isUserPropMatch"
value="1">
<html:eek:ptions collection="userProp"
labelProperty="label" property="value" selected/>
</logic:equal>

<logic:notEqual name="userProp" property="isUserPropMatch" value="1">
<html:eek:ptions collection="userProp" labelProperty="label"
property="value" />
</logic:notEqual>

</html:select>

All the property names has get and set methods in the form bean.
isUserPropMatch is the field that has either 0 or 1 as its value.

formbean
---------------------

public Collection alPropositions;
public String[] selProposition;
public String[] selectProposition;
public Collection userPropositions;
public Collection userAssoProp;

all the above has the get and set methods.

actionclass
------------------------

String clickuserId = request.getParameter(CommonConstants.U_ID);
addUserForm.setUserPropositions(DAOFetchMasterRecords.getUserAssociatedProposition(clickuserId));
ArrayList user_proposition =
DAOFetchMasterRecords.getUserAssociatedProposition(clickuserId);
System.out.println("vas user role of the user
is:"+user.getVAS_USER_ROLE());
request.setAttribute("userProp",user_proposition);

getUserAssociatedProposition() is the method that retrives the values
that are associated wiht teh user.


The jsp gets displayed with no error or exception but the values in the
list are not getting highlighted.

kindly help.

i have given the part of jsp wherein i have the collection that has to
be highlighted.

The rendered html code looks like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>

<HEAD><TITLE>BT Online SAT Application</TITLE>
<script language="JavaScript" src="js/editUser.js"></script>
<SCRIPT language=javascript src="./js/help.js"></SCRIPT>
<META http-equiv=Content-Language content=en-us>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252">
<LINK href="/OSAT/stylesheets/Style.css" type=text/css rel=stylesheet>
<STYLE type=text/css>
..style3 {
FONT-SIZE: 11px; FONT-FAMILY: Tahoma
}
..style7 {
FONT-WEIGHT: bold; COLOR: #999999;
}
</STYLE>


<SCRIPT language=javascript>
// Scripts move
var userProp = [com.bt.osat.util.OptionItem@287e316,
com.bt.osat.util.OptionItem@287e387,
com.bt.osat.util.OptionItem@287e3fa,
com.bt.osat.util.OptionItem@287e464,
com.bt.osat.util.OptionItem@287e4d1,
com.bt.osat.util.OptionItem@287e53b,
com.bt.osat.util.OptionItem@287e5a6,
com.bt.osat.util.OptionItem@287e611,
com.bt.osat.util.OptionItem@287e679,
com.bt.osat.util.OptionItem@287e6e5,
com.bt.osat.util.OptionItem@287e75c,
com.bt.osat.util.OptionItem@287e7d1,
com.bt.osat.util.OptionItem@287e839,
com.bt.osat.util.OptionItem@287e8a6,
com.bt.osat.util.OptionItem@287e913,
com.bt.osat.util.OptionItem@287e97b,
com.bt.osat.util.OptionItem@287e9e8,
com.bt.osat.util.OptionItem@287ea62,
com.bt.osat.util.OptionItem@287ead1,
com.bt.osat.util.OptionItem@287eb3a,
com.bt.osat.util.OptionItem@287ebb5,
com.bt.osat.util.OptionItem@287ec1e,
com.bt.osat.util.OptionItem@287ec88,
com.bt.osat.util.OptionItem@287ecf1,
com.bt.osat.util.OptionItem@287ed59,
com.bt.osat.util.OptionItem@287edc2,
com.bt.osat.util.OptionItem@287ee43,
com.bt.osat.util.OptionItem@287eeb5,
com.bt.osat.util.OptionItem@287ef20,
com.bt.osat.util.OptionItem@287ef89,
com.bt.osat.util.OptionItem@287f005,
com.bt.osat.util.OptionItem@287f071,
com.bt.osat.util.OptionItem@287f0e0,
com.bt.osat.util.OptionItem@287f14b,
com.bt.osat.util.OptionItem@287f1b5,
com.bt.osat.util.OptionItem@287f221,
com.bt.osat.util.OptionItem@287f289,
com.bt.osat.util.OptionItem@287f2f3,
com.bt.osat.util.OptionItem@287f35d,
com.bt.osat.util.OptionItem@287f3e8,
com.bt.osat.util.OptionItem@287f475,
com.bt.osat.util.OptionItem@287f4e0,
com.bt.osat.util.OptionItem@287f54d];

</SCRIPT>





<META content="MSHTML 6.00.2900.2668" name=GENERATOR></HEAD>
<BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>
<form name="addUserForm" method="post" action="/OSAT/EditUser.do">

<input type="hidden" name="userId" value="317">
<input type="hidden" name="userPM" value="1341">

<input type="hidden" name="hCurrentUserIsPM" value="true">
<input type="hidden" name="hOnlyUser" value="false">
<input type="hidden" name="hOnlyPM" value="false">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width=497 background=./images/topbanner_bg.jpg><img
src="./images/topbanner_BTLogo.gif" width="219" height="83"></TD>
<TD width=497><IMG height=83
src="./images/topbanner_left.jpg" width=497
border=0></TD></TR></TBODY></TABLE>

<TABLE id=table1 height="100%" cellSpacing=0 cellPadding=0 width="100%"

border=0>
<TBODY>

<TD>
<TABLE height="98%" cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>

<TD>
<TABLE height="100%" cellSpacing=0 cellPadding=0
width="100%"
border=0>
<TBODY>
<TR>
<TD vAlign=top height=50>
<TABLE id=table2 cellSpacing=0 cellPadding=0
width="100%"
border=0>
<TBODY>

<TR>
<TD vAlign=top><!-- The Tab area starts here -->
<TABLE id=table1 height="100%" cellSpacing=0
cellPadding=0
width="100%" border=0>
<TBODY>

<TR>
<TD height=20>
<TABLE cellSpacing=0 cellPadding=0 width="100%"

border=0>
<TBODY>
<TR>

</TR>

<TR>
<TD width=7><IMG height=20
src="images/tab_secline_bit.gif" width=7
border=0></TD>
<TD class=subtab background=""
bgColor=#e8e7e0><IMG src="images/dot.gif"

width=5 border=0><a
href="welcomePage.do">Main
Menu</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#"
onClick="logout()">Logout</a></TD>
<TD align=right class=subtab2 background=""
bgColor=#e8e7e0>User
Name&nbsp;&nbsppropadd j</TD>
<TD width=6><IMG height=20
src="images/tab_secline_rightbit.gif"
width=6
border=0></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD>
<TABLE id=table3 cellSpacing=0
cellPadding=0 width="100%" border=0>
<TBODY>
<TR>

<TD vAlign=top><TABLE cellSpacing=5
cellPadding=0 width="80%" align="center"
border=0>
<TBODY>

<tr>
<td width="50%" colspan="5" class=style3 align="center">
<font color="#0066CC">Edit User</font>
<table width="=100%">
</table>
<br>
<table align="center" width="230" border="0" cellpadding="2"
cellspacing="0" style="border-collapse:collapse" bordercolor="#DDD8D2">
<tr >
<td colspan="2">

<table border="0" align="center">
<tr>
<td nowrap><input type="checkbox" name="checkPM" class="check"
onClick="checkUserForAssociatedProduct(this,'Y','317')" checked
/>Product Manager</td>
<td nowrap><input type="checkbox" name="checkAdmin" class="check"
onClick="enableDisable()" checked />Promote to Admin</td>
</tr>
<tr>
<td align=left nowrap>Proposition</td>
<td>



<select name="selProposition" multiple="multiple"
onchange="showProposition()"><logic:equal name="userProp"
property="isUserPropMatch" value="1">
[com.bt.osat.util.OptionItem@287c62b,
com.bt.osat.util.OptionItem@287c6a6,
com.bt.osat.util.OptionItem@287c717,
com.bt.osat.util.OptionItem@287c781,
com.bt.osat.util.OptionItem@287c7eb,
com.bt.osat.util.OptionItem@287c855,
com.bt.osat.util.OptionItem@287c8bf,
com.bt.osat.util.OptionItem@287c92a,
com.bt.osat.util.OptionItem@287c992,
com.bt.osat.util.OptionItem@287c9ff,
com.bt.osat.util.OptionItem@287ca76,
com.bt.osat.util.OptionItem@287cae8,
com.bt.osat.util.OptionItem@287cb50,
com.bt.osat.util.OptionItem@287cbba,
com.bt.osat.util.OptionItem@287cc27,
com.bt.osat.util.OptionItem@287cc8f,
com.bt.osat.util.OptionItem@287ccfe,
com.bt.osat.util.OptionItem@287cd78,
com.bt.osat.util.OptionItem@287cde5,
com.bt.osat.util.OptionItem@287ce4e,
com.bt.osat.util.OptionItem@287ced1,
com.bt.osat.util.OptionItem@287cf3a,
com.bt.osat.util.OptionItem@287cfa6,
com.bt.osat.util.OptionItem@287d00f,
com.bt.osat.util.OptionItem@287d077,
com.bt.osat.util.OptionItem@287d0e0,
com.bt.osat.util.OptionItem@287d161,
com.bt.osat.util.OptionItem@287d1d1,
com.bt.osat.util.OptionItem@287d23c,
com.bt.osat.util.OptionItem@287d2a6,
com.bt.osat.util.OptionItem@287d321,
com.bt.osat.util.OptionItem@287d38d,
com.bt.osat.util.OptionItem@287d3fb,
com.bt.osat.util.OptionItem@287d466,
com.bt.osat.util.OptionItem@287d4d1,
com.bt.osat.util.OptionItem@287d53d,
com.bt.osat.util.OptionItem@287d5a6,
com.bt.osat.util.OptionItem@287d60f,
com.bt.osat.util.OptionItem@287d679,
com.bt.osat.util.OptionItem@287d71e,
com.bt.osat.util.OptionItem@287d7b5,
com.bt.osat.util.OptionItem@287d81f,
com.bt.osat.util.OptionItem@287d88c]
<html:eek:ptions collection="userProp" labelProperty="label"
property="value" selected/>
</logic:equal>

<logic:notEqual name="userProp" property="isUserPropMatch" value="1">
<option value="7">Remote Access</option>
<option value="8">SIS</option>
<option value="2">LAN</option>
<option value="51">NEW &amp; PROP</option>
<option value="9">VOICE</option>
<option value="11">TRANSFORM</option>
<option value="4">ASB Managed</option>
<option value="6">International</option>
<option value="13">ICT</option>
<option value="25">PS VPN MATRIX</option>
<option value="24">IPT</option>
<option value="23">SVPN</option>
<option value="22">ALL</option>
<option value="20">INTERNET</option>
<option value="19">VIRTUAL PRIVATE NETWORKS</option>
<option value="17">RAS</option>
<option value="21">CROSS PRODUCT COMPONENTS</option>
<option value="15">MANAGED MOBILE</option>
<option value="48">MOBILITY</option>
<option value="47">REUTERS</option>
<option value="46">SPRING</option>
<option value="45">GLOBAL</option>
<option value="43">IP CONVERGE</option>
<option value="44">GENERIC</option>
<option value="41">N3</option>
<option value="40">C&amp;IS</option>
<option value="39">EUROPEAN SOLUTIONS</option>
<option value="49">VOCERA</option>
<option value="33">PS AAI MATRIX</option>
<option value="34">QWEST</option>
<option value="31">CONNECTED SOLUTIONS</option>
<option value="30">APPLICATIONS HOSTING</option>
<option value="29">BANDWIDTH</option>
<option value="28">VOICE PORTFOLIO</option>
<option value="27">BAP</option>
<option value="26">INTERNET PORTFOLIO</option>
<option value="14">MCS</option>
<option value="5">ISDN WAN</option>
<option value="3">ASB Reactive</option>
<option value="1">Fixed Link WAN</option>
<option value="10">WAN</option>
<option value="52">TEST&amp;TEST</option>
<option value="50">N3 - TEST PROPOSITION</option>

</logic:notEqual></select>

</td>
</tr>

</table>


</td>
</tr>
<tr>
<td colspan="2"
style="padding-left:85px;"></td>
</tr>

<tr >
<td width="50%" align=left> <label
for="txtFN"> First Name</td>
<td width="50%" align=left><div
align="center"><input type="text" name="txtFN" value="Deep" id="txtFN">
</div></td>
</tr>
<tr >
<td align=left> <label for="txtLN">
Last Name &nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align=left><div
align="center"><input type="text" name="txtLN" value="Subbu"
id="txtLN">
</div></td>
</tr>
<tr >
<td align=left> <label
for="txtEIN"> EIN &nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align=left><div
align="center"><input type="text" name="txtEIN" value="4559"
id="txtEIN">
</div></td>
</tr>
<tr >
<td align=left> <label
for="txtEmail"> Email &nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align=left><div
align="center"><input type="text" name="txtEmail"
value="(e-mail address removed)" id="txtEmail">
</div></td>
</tr>
<tr >
<td align=left> <label
for="txtUID"> User ID</td>
<td align=left><div
align="center"><input type="text" name="txtUID" value="deep">
</div></td>
</tr>
<tr >
<td></td>
<td align=left><div
align="center"></div></td>
</tr>
<tr >
<td align=left> <label
for="txtPwd"> Password &nbsp;&nbsp;&nbsp;&nbsp;</td>
<td align=left><div align="center">
<input type="password"
styleId="txtPwd" value='abcd1234' name="txtPwd" />
</div></td>
</tr>
</table></td>
</tr>
<TR>

</TR>

</TBODY>
</TABLE>
<TABLE cellSpacing=5 cellPadding=0 width="60%" align="center">
<tr>
<td align="center"
colspan="3"><font color="#0066CC">User Privileges</font></td>
</tr>

<tr >
<td width="33%"><table width="200"
height="100" border="0" style="border: 1px solid #d5c8b7"
cellpadding="3" cellspacing="0">
<tr>
<td width="42%" align="left"
nowrap>VAS/NS/PACKAGE </td>
<td width="58%"><input
type="checkbox" name="checkVas" class="check" onClick="enableDisable()"
checked /></td>
</tr>
<tr >
<td align=left nowrap>Read
Only</td>
<td align=left><input
type="checkbox" name="vasReadOnly" class="check" />
</td>
</tr>
<tr>
<td align=left nowrap>User
Role</td>
<td align=left>
<label for="label1"></label>
<INPUT type="text" id="label1" value="Product Manager"
style="display:none " readonly="true">
<logic:present name="addUserForm"
property="vasUserRoleAll">

<select name="vasRole"><option value="">Select</option>
<option value="DB MANAGER">DB MANAGER</option>
<option value="SYSTEM EXPERT">SYSTEM EXPERT</option></select>
</logic:present>

</td>
</tr>
</table></td>
<td width="33%" ><table width="200"
height="100"
border="0" style="border: 1px solid #d5c8b7" cellpadding="3"
cellspacing="0">
<tr>
<td align="left" width="50%"
nowrap>BESPOKE/VAS</td>
<td><input type="checkbox"
name="checkBespoke" class="check" onClick="enableDisable()" checked
/></td>
</tr>
<tr >
<td align=left nowrap>Read
Only</td>
<td align=left><input
type="checkbox" name="bespokeReadOnly" class="check" />
</td>
</tr>
<tr >
<td height="31" align=left
nowrap>User Role</td>
<td align=left>
<INPUT type="text" id="label2" value="Product Manager"
style="display:none " readonly="true">
<logic:present name="addUserForm"
property="bespokeUserRoleAll">

<select name="bespokeRole"><option
value="">Select</option>
<option value="SYSTEM EXPERT">SYSTEM EXPERT</option>
<option value="DB MANAGER">DB MANAGER</option></select>
</logic:presnt>
</td>
</tr>
</table></td>
<td width="33%">
<table width="200" height="100" border="0" style="border: 1px solid
#d5c8b7" cellpadding="3" cellspacing="0">
<tr>
<td align="left" width="50%" nowrap>CPE/CPE ITEM </td>
<td><input type="checkbox" name="checkCpe" class="check"
onClick="enableDisable()" checked /></td>
</tr>
<tr >
<td align=left nowrap>Read Only</td>
<td align=left><input type="checkbox" name="cpeReadOnly"
class="check" />
</tr>
<tr >
<td align=left nowrap>User Role</td>
<td align=left>
<INPUT type="text" id="label3" value="Product Manager"
style="display:none " readonly="true">
<logic:present name="addUserForm" property="cpeUserRoleAll">

<select name="cpeRole"><option value="">Select</option>
<option value="RADAR OWNER">RADAR OWNER</option>
<option value="SALES TOOL MANAGER">SALES TOOL MANAGER</option></select>
</logic:presnt>

</td>
</tr>
</table>
</td>
</tr>

<tr>
<td colspan="3"><center>
<input type="hidden"
name="buttonClick">
<input type="button" name="back" value="Back"
onclick="history.go(-1);return true;">&nbsp;&nbsp;
<input type="button" name="save"
value="Save" onclick="validateForm()">&nbsp;&nbsp;
<input type="button" name="refresh" value="Reset"
onclick="window.document.location.reload(true)">
</center></td>
</tr>
</TABLE>
<!-- Content area starts here -->

<!-- Content area ends here --></TD>
<TD width=6
background=images/tab_rightmargin.gif><IMG
height=1 src="images/tab_rightmargin.gif"

width=6
border=0></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD height=7>
<TABLE id=table4 cellSpacing=0 cellPadding=0
width="100%" border=0>
<TBODY>
<TR>
<TD width=7><IMG height=7
src="images/tab_bott_left_corner.gif"
width=7 border=0></TD>
<TD
background=images/tab_bott_bg.gif><IMG
height=7 src="images/tab_bott_bg.gif"
width=1 border=0></TD>
<TD width=6><IMG height=7
src="images/tab_bott_right_corner.gif"
width=6

border=0></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD
height=40>&nbsp;</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</form></BODY></HTML>

<script>
// Script for enable, disable should not put at top.
enableDisableFields();
maintainUserId(window.document.forms[0].txtUID.value);
enableDisableUserId(userIdForUser);
ckeckAdminRoles();
</script>

Thanks in advance.

Cheers,
Vasu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top