rkyakkala 0 Newbie Poster

Hi,

Note:selected item is not seen in the drop down list its going to default one.

In my jsp application i am having two drop down lists (contract and devicename) when i selected contract name proper device name is loading in the select list of device name But in contract drop down list the selected contract is not visible its going to initial one.what can i make to do to get the selected one?
i am also keeping javascript function code:

function setFilePrefix(contractname){
var contractname=(contractname.options[contractname.selectedIndex].value);
if(true){
window.location.replace("./viewMapTool.html?contractname="+contractname);
}
<div id="contract">
<tr>
	<td>
		List of Contracts
	</td>

	<td>
		 <select name="contract" onchange="return setFilePrefix(this)">
			   <c:forEach items='${perspectivetreeMap}'var='contr'>
                         <option value="<c:out value='${contr.key}'/>" <c:if test='${contr.key == contract.id}'>selected="selected"</c:if> >
                <c:out value='${contr.value}'/></option>
			   </c:forEach>
		 </select>
	</td>

</tr>
</div>
<tr>
        <td>
                Choose Device Name
        </td>
        <td>
                <select name="devicename">

                 <c:forEach items='${deviceList}' var='deviceList'>
                                 <option value="<c:out value='${deviceList}'/>">
                                        <c:out value='${deviceList}'/>
                                </option>
                     </c:forEach>

                </select>
        </td>
</tr>

regards,
rmaa

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.