I'm storing the query result inside JavaScript variable, I used JSP to fetch data from database,
so I declared one JSP string variable to store record. and I'm assigning that variable to JavaScript variable.
var opt="";
<%
String sdm="", smg="",sname="",s1="kkk";
sql="SELECT DISTINCT(BFM_Name) FROM BarsFeeMaster ORDER BY BFM_Name";
Statement stmt11 = connection.createStatement();
ResultSet rs11 =stmt11.executeQuery(sql);
while(rs11.next())
{
sname=rs11.getString("BFM_Name");
%>
opt+="<option value='<%=sname%>'>abc</option>";
<%
}
%>
Here same is not accessible, in sense when I used this code my select tag get disappeared.
try this..
(String)rs11.getobject() in value field
Try this
var opt="";
<%
String sdm="", smg="",sname="",s1="kkk";
sql="SELECT DISTINCT(BFM_Name) FROM BarsFeeMaster ORDER BY BFM_Name";
Statement stmt11 = connection.createStatement();
ResultSet rs11 =stmt11.executeQuery(sql);
while(rs11.next())
{
sname=rs11.getString("BFM_Name");
%>
opt+="<option value='"<%=sname%>"'>abc</option>";
<%
}
%>
Greetings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.