hello,
I have a problem with dropdown list refreshing.
The code is pasted below:
<HTML>
<body >
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.* " %>
<%@ page import="java.util.*" %>
<jsp:useBean id="Lib" class="Lib.cddatabase">
<jsp:setProperty name="Lib" property="*"/>
</jsp:useBean>
<script language="javascript">
function locfun()
{
cdform.location.value = cdform.combo2.value;
}
function new1_click()
{
cdform.source.value = " ";
}
function new2_click()
{
cdform.location.value = " ";
}
function new3_click()
{
cdform.status.value = " ";
}
function new4_click()
{
cdform.vendorid.value = " ";
}
function statfun()
{
cdform.status.value = cdform.combo3.value;
}
function venfun()
{
cdform.vendorid.value = cdform.combo4.value;
}
function sourcefun()
{
cdform.source.value = cdform.combo1.value;
}
</script>
<%! String flag; %>
<% Lib.connect(); %>
<br>
<% Lib.select(); %>
<%@ page import="java.util.Vector" %>
<% Vector avendorid = Lib.getvendorid(); %>
<% Vector avendorname = Lib.getvendorname(); %>
<% Vector asourceid = Lib.getsourceid(); %>
<% Vector asourcename = Lib.getsourcename(); %>
<% Vector alocationid = Lib.getlocationid(); %>
<% Vector alocationname = Lib.getlocationname(); %>
<% Vector astatusid = Lib.getstatusid(); %>
<% Vector astatusname = Lib.getstatusname(); %>
<% Vector acdkey = Lib.getcdkey(); %>
<table align =center>
<tr> <td> <%@ include file="../../images/head.html" %> </td> </tr>
</table>
<br><br>
<TABLE bgcolor = "#fcf7ec" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 50 >
<TR>
<TD ALIGN = CENTER>
</TD>
<TD ALIGN = CENTER>
</TD>
<TD ALIGN = CENTER>
</TD>
</TR>
</TABLE>
<%! String title,purdate,keywords,sourceid,price,loc,status,vendorid; %>
<form name = "cdform" method = "post" action="VIEWDET.jsp">
<TABLE bgcolor = "#fcf7ec" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 325 >
<tr> <td> </td> </tr>
<TR>
<TD ><!--ADD ANOTHER TABLE-->
<TABLE border = 0 bgcolor = "#eee0c5" bordercolor = "#eee0c5" cellpadding = 0 cellspacing = 0 align = center width = 300 height = 200 >
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>CDKEY</FONT></LABEL>
</TD>
<TD >
<select name = "combo1" onchange = "<% Lib.setcdkey(request.getParameter("combo1"); %> cdform.submit(); " VALUE = <% request.getParameter("combo1"%> >
<%
for (int i=0; i < acdkey.size(); i++) { %>
<option value="<%=acdkey.elementAt(i)%>"><%=acdkey.elementAt(i)%></option>
<% } %>
</select>
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>TITLE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="title">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>SOURCE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="source" value = "<%=Lib.test() %>" >
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>PRICE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="price">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>PURCHASE DATE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="purchasedate">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>LOCATION</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="location" >
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>STATUS</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="status">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>KEYWORDS</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="keyword">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>VENDOR ID</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="vendorid" >
</TD>
</TR>
</TABLE>
<TABLE bgcolor = "#eee0c5" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 300 height = 1 >
<TR>
<TD >
<FONT COLOR = "#eee0c5"> </FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD>
<TABLE bgcolor = "#fcf7ec" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 1 >
<TR>
<TD >
<TABLE border = 0 bgcolor = "#eee0c5" bordercolor = "#eee0c5" cellpadding = 0 cellspacing = 0 align = center width = 300 height = 40 >
<TR>
<TD ALIGN=CENTER>
<!-- BUTTON HERE-->
<input name="button" type="submit" value="PREV" style="WIDTH: 99px; HEIGHT: 22px; BACKGROUND-COLOR: tan" size ="33">
</TD>
<TD ALIGN=CENTER>
<!-- BUTTON HERE-->
<input name="button" type="submit" value="NEXT" style="WIDTH: 99px; HEIGHT: 22px; BACKGROUND-COLOR: tan" size ="33">
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</tr>
<tr> <td> </td> </tr>
<TR> <td> <%@ include file="../../images/footer.html" %> </TD> </TR>
</TABLE>
</form>
</body>
</html>
The problem is that as I change the value of dropdown list , combo1 the changes get reflected to the text box source .. but since the page is getting reloaded, the combo box gets refreshed and I lose the selected value..
I have a bean which gets the value from the database and returns an array.
I need the combo box to retain its previous value..
I have a problem with dropdown list refreshing.
The code is pasted below:
<HTML>
<body >
<%@ page import="java.lang.*" %>
<%@ page import="java.sql.* " %>
<%@ page import="java.util.*" %>
<jsp:useBean id="Lib" class="Lib.cddatabase">
<jsp:setProperty name="Lib" property="*"/>
</jsp:useBean>
<script language="javascript">
function locfun()
{
cdform.location.value = cdform.combo2.value;
}
function new1_click()
{
cdform.source.value = " ";
}
function new2_click()
{
cdform.location.value = " ";
}
function new3_click()
{
cdform.status.value = " ";
}
function new4_click()
{
cdform.vendorid.value = " ";
}
function statfun()
{
cdform.status.value = cdform.combo3.value;
}
function venfun()
{
cdform.vendorid.value = cdform.combo4.value;
}
function sourcefun()
{
cdform.source.value = cdform.combo1.value;
}
</script>
<%! String flag; %>
<% Lib.connect(); %>
<br>
<% Lib.select(); %>
<%@ page import="java.util.Vector" %>
<% Vector avendorid = Lib.getvendorid(); %>
<% Vector avendorname = Lib.getvendorname(); %>
<% Vector asourceid = Lib.getsourceid(); %>
<% Vector asourcename = Lib.getsourcename(); %>
<% Vector alocationid = Lib.getlocationid(); %>
<% Vector alocationname = Lib.getlocationname(); %>
<% Vector astatusid = Lib.getstatusid(); %>
<% Vector astatusname = Lib.getstatusname(); %>
<% Vector acdkey = Lib.getcdkey(); %>
<table align =center>
<tr> <td> <%@ include file="../../images/head.html" %> </td> </tr>
</table>
<br><br>
<TABLE bgcolor = "#fcf7ec" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 50 >
<TR>
<TD ALIGN = CENTER>
</TD>
<TD ALIGN = CENTER>
</TD>
<TD ALIGN = CENTER>
</TD>
</TR>
</TABLE>
<%! String title,purdate,keywords,sourceid,price,loc,status,vendorid; %>
<form name = "cdform" method = "post" action="VIEWDET.jsp">
<TABLE bgcolor = "#fcf7ec" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 325 >
<tr> <td> </td> </tr>
<TR>
<TD ><!--ADD ANOTHER TABLE-->
<TABLE border = 0 bgcolor = "#eee0c5" bordercolor = "#eee0c5" cellpadding = 0 cellspacing = 0 align = center width = 300 height = 200 >
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>CDKEY</FONT></LABEL>
</TD>
<TD >
<select name = "combo1" onchange = "<% Lib.setcdkey(request.getParameter("combo1"); %> cdform.submit(); " VALUE = <% request.getParameter("combo1"%> >
<%
for (int i=0; i < acdkey.size(); i++) { %>
<option value="<%=acdkey.elementAt(i)%>"><%=acdkey.elementAt(i)%></option>
<% } %>
</select>
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>TITLE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="title">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>SOURCE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="source" value = "<%=Lib.test() %>" >
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>PRICE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="price">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>PURCHASE DATE</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="purchasedate">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>LOCATION</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="location" >
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>STATUS</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="status">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>KEYWORDS</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="keyword">
</TD>
</TR>
<TR>
<TD >
<LABEL><FONT Face = "Verdana" size = 1 color = "#eee0c5"> </FONT></LABEL>
</TD>
<TD >
<LABEL><FONT Face = "Verdana" size = 1>VENDOR ID</FONT></LABEL>
</TD>
<TD >
<INPUT type="text" name="vendorid" >
</TD>
</TR>
</TABLE>
<TABLE bgcolor = "#eee0c5" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 300 height = 1 >
<TR>
<TD >
<FONT COLOR = "#eee0c5"> </FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD>
<TABLE bgcolor = "#fcf7ec" border = 0 cellpadding = 0 cellspacing = 0 align = center width = 800 height = 1 >
<TR>
<TD >
<TABLE border = 0 bgcolor = "#eee0c5" bordercolor = "#eee0c5" cellpadding = 0 cellspacing = 0 align = center width = 300 height = 40 >
<TR>
<TD ALIGN=CENTER>
<!-- BUTTON HERE-->
<input name="button" type="submit" value="PREV" style="WIDTH: 99px; HEIGHT: 22px; BACKGROUND-COLOR: tan" size ="33">
</TD>
<TD ALIGN=CENTER>
<!-- BUTTON HERE-->
<input name="button" type="submit" value="NEXT" style="WIDTH: 99px; HEIGHT: 22px; BACKGROUND-COLOR: tan" size ="33">
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</tr>
<tr> <td> </td> </tr>
<TR> <td> <%@ include file="../../images/footer.html" %> </TD> </TR>
</TABLE>
</form>
</body>
</html>
The problem is that as I change the value of dropdown list , combo1 the changes get reflected to the text box source .. but since the page is getting reloaded, the combo box gets refreshed and I lose the selected value..
I have a bean which gets the value from the database and returns an array.
I need the combo box to retain its previous value..