I have a jsp struts file with
<html:select styleId="selectedop" property="selectedop" onchange="javascript:submitit();" value="select">
<html:option value="--select--">--select--</html:option>
<%
try {
String url = connectionString;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url);
ResultSet rs;
PreparedStatement pst = con.prepareStatement(selectQuery);
rs = pst.executeQuery();
while (rs.next()) {
String name = rs.getString(1);
%>
<html:option value="<%=name%>"><%=name%></html:option>
<%
}%>
<%
} catch (Exception e) {
out.print(e);
}
%>
</html:select>
its ActionForm class contains
private String selectedop;
and its getter and setter methods.
problem is after submitting reloading jsp page, the value selected in "selectedop" change to its first value.
But I want it to as set as previous.
So I set its value in its Action class using its setter method in ActionForm class.
But it did not worked.
So how I can set value of html:select from Action class