illegal start of expression & type
<select name="weatherStat" id="States">
<%
try {
Connection connection = DataBaseConnectionManager.getConnection();
String sqlQuery = "SELECT distinct state FROM ols_weather_current ORDER BY 1 asc";
ResultSet rst2;
PreparedStatement pstmt;
pstmt = connection.prepareStatement(sqlQuery);
rst2 = pstmt.executeQuery(sqlQuery);
while (rst2.next ()) {
<option value=rst2.getString("state")></option>
}
rst2.close();
pstmt.close();
}
catch (Exception e) {
e.printStackTrace();
}
%>
</select>
having trouble...any suggestions?
mimsc
Junior Poster in Training
70 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
You just have your html and java code intermingled here and need to fix the tags
while (rst2.next ()) {
%>
<option value='<%= rst2.getString("state") %>'></option>
<%
}
rst2.close();
or use out.write() to generate the html option tags instead.
(if jwenting pops in though he will tell you not to be using java in jsp pages at all, which is consistent with the current recommendations in JSP 2.0)
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847