Hi,
I am trying to display the data of one column from two table named questioned and groupid in my
jsp page. But the error occurring at the marked line is: can not find Symbol option, ; expected like:
Here is an my code:
<blockquote><font size="1" face="Verdana, Arial">code:</font><hr><pre name="code" class="core"><font size="2">
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language ="java" %>
<%@ page import="java.sql.*, javax.sql.*, javax.naming.*,java.io.*,java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ADD EVENT</title>
</head>
<body>
<form name="addevent" action="addeventok.jsp" method="POST">
<table border="1" width="100">
<thead>
<tr>
<center>ADD-EVENT</center>
</tr>
</thead>
<tbody>
<tr>
<td><B>EVENT-NAME</B></td>
<td><input type="text" name="name" value="" size="255" /></td>
</tr>
<tr>
<td><b>EVENT-TYPE</b></td>
<td><select name="eventtype">
<option><b>PUBLISH</b></option>
<option><B>UNPUBLISH</B></option>
</select></td>
</tr>
<tr>
<td><B>QUESTION-TYPE</B></td>
<%
Connection connection = null;
Statement st = null;
ResultSet rs = null;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mynewdatabase","root", "root123");
st=con.createStatement();
%>
<td><select name="question">
<%
try {
rs = st.executeQuery("Select * from questionid");
while (rs.next())
{
<option value = "<%=rs.getString("Questionid")%>" ><%=rs.getString(2)%></option>
<%
}
}
finally
{
if (rs != null)
{
rs.close();
rs = null;
}
if (st != null)
{
st.close();
st = null;
}
}
%>
%>
</select>
</td>
</tr>
<tr>
<td><B>TARGET-GROUP</B></td>
<td><select name="group">
<%
try {
rs = st.executeQuery("Select * from groupid");
while (rs.next())
{
%>
<option value = "<%=rs.getString("groupid")%>" ><%=rs.getString(2)%></option>
<%
}
}
finally
{
if (rs != null)
{
rs.close();
rs = null;
}
if (st != null)
{
st.close();
st = null;
}
}
%>
</select>
</td>
</tr>
<tr>
<td>USERR IDENTITY</td>
<td><select name="identity">
<option>Anonymous</option>
<option>Identify</option>
</select></td>
</tr>
<tr>
<td><input type="submit" value="ADD" name="add" /></td>
<td><input type="reset" value="RESET" name="reset" /></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
</font></pre><hr></blockquote>
Any suggestion is highly appreciated.
Thanks and Regards
Harshal
[ July 16, 2008: Message edited by: Harshal Gurav ]