illegal start of expression & type

Reply

Join Date: Aug 2007
Posts: 66
Reputation: mimsc is an unknown quantity at this point 
Solved Threads: 0
mimsc mimsc is offline Offline
Junior Poster in Training

illegal start of expression & type

 
0
  #1
Aug 30th, 2007
  1.  
  2. <select name="weatherStat" id="States">
  3. <%
  4.  
  5.  
  6. try {
  7. Connection connection = DataBaseConnectionManager.getConnection();
  8. String sqlQuery = "SELECT distinct state FROM ols_weather_current ORDER BY 1 asc";
  9. ResultSet rst2;
  10. PreparedStatement pstmt;
  11. pstmt = connection.prepareStatement(sqlQuery);
  12. rst2 = pstmt.executeQuery(sqlQuery);
  13. while (rst2.next ()) {
  14.  
  15. <option value=rst2.getString("state")></option>
  16. }
  17.  
  18. rst2.close();
  19. pstmt.close();
  20. }
  21.  
  22. catch (Exception e) {
  23. e.printStackTrace();
  24. }
  25.  
  26. %>
  27.  
  28.  
  29. </select>


having trouble...any suggestions?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,505
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 521
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: illegal start of expression & type

 
0
  #2
Aug 31st, 2007
You just have your html and java code intermingled here and need to fix the tags
  1. while (rst2.next ()) {
  2. %>
  3. <option value='<%= rst2.getString("state") %>'></option>
  4. <%
  5. }
  6.  
  7. 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)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for JSP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC