<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?

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.