| | |
illegal start of expression & type
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2007
Posts: 66
Reputation:
Solved Threads: 0
java Syntax (Toggle Plain Text)
<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 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)
JSP Syntax (Toggle Plain Text)
while (rst2.next ()) { %> <option value='<%= rst2.getString("state") %>'></option> <% } rst2.close();
(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)
![]() |
Similar Threads
- illegal start of expression & type (Java)
- illegal start of expression (Java)
- JAVA Illegal Start of Expression Error (Java)
- Fibonacci Recursion - Illegal Start of expression! (Java)
- illegal start of expression (Java)
- Why illegal start of expression error? (Java)
- illegal start of expression (Java)
Other Threads in the JSP Forum
- Previous Thread: generating dynamic/runtime query
- Next Thread: query to populate a drop-down
| Thread Tools | Search this Thread |
Tag cloud for JSP
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient project read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






