What you need to do is using javascript from the left frame to notify the right frame each time a user selects a new item from the select object.
Here I wrote a template code of how to notify the right frame from the left frame when there is a rew item is selected. By the way, this code I wrote on-the-fly without testing it so please check the syntax since I might be making mistakes about the syntax.
//File: main.html
<html>
<head>
<script type='text/javascript'>
</script>
</head>
<frameset cols='30%,70%'>
<frame src='left.jsp' name='left'>
<frame src='right.jsp' name='right'>
</framset>
<html>
---------------------------------
//File: left.jsp
<html>
<head>
<script type='text/javascript'>
function notifyRightFrameWithNewItemSelected( value )
{
window.top.frames['right'].updateNewItemSelected( value );
}
function itemSelected()
{
var oSelect = document.getElementById( 'resultSet' );
if ( oSelect != null )
{
var item = oSelect.options[oSelect.selectedIndex].value;
notifyRightFrameWithNewItemSelected( item );
}
}
</script>
</head>
<body>
<%-- Assume your resultset is a List object containing a collection
of Strings sending back from the server via request object --%>
<%
List resultSet = (List) request.getAttribute( "resultSet" );
%>
<select name='resultSet' id='resultSet' onselect='itemSelected()'>
<%
if ( resultSet != null && resultSet.size() > 0 )
{
for ( int i = 0; i < resultSet.size(); i++ )
{
String item = (String) resultSet.get( i );
%>
<option value='<%=item%>'><%=item%></option>
<%
}
}
%>
</select>
</body>
</html>
---------------------------------
//File right.jsp
<html>
<head>
<script type='text/javascript'>
function updateNewItemSelected( newItem )
{
document.myForm.resultSetItem.value = newItem;
}
</script>
</head>
<body>
<%-- display a selected item from the left frame in the textbox field --%>
<form name='myForm' id='myForm'>
<input type='text' name='resultSetItem' value=''>
</form>
</body>
</html>
|