Hi All,
I was using a Hash Table to get List of values and Keys from Database and populate combo boxes in
JSP.
The values were not sorted because of this.So I am now using a TreeMap for the same.
The following is the code I use.
=================================
Iterator it_Industry_Elements = null;
Iterator it_Industry_Keys= null;
TreeMap tm_Industry = mgr.getListSorted("Industry");
Collection col_Industry = tm_Industry.values();
Set set_Industry = tm_Industry.keySet();
Iterator it_Industry_Elements= col_Industry.iterator();
Iterator it_Industry_Keys= set_Industry.iterator();
String str_Industry_Keys = null;
String str_Industry_Elements = null;
while (it_Industry_Elements.hasNext() && it_Industry_Keys.hasNext())
{
str_Industry_Keys = (String)it_Industry_Keys.next();
str_Industry_Elements = (String)it_Industry_Elements.next();
%>
<option value="<%out.println(str_Industry_Keys);%>">
<%out.println(str_Industry_Elements);%>
</option>
<%
}// end while
%>
</select>
But I get the following error in JSP
=====================================
500 Internal Server Error
Java Server Page Translation Error
Error during compilation :
D:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_Previous__Employment__Create.java:481: Class java.util.TreeMap not found in type declaration.
TreeMap tm_Industry = null;
^
D:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_Previous__Employment__Create.java:482: Class pagecompile.jsp.Collection not found in type declaration.
Collection col_Industry = null;
^
D:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_Previous__Employment__Create.java:483: Class pagecompile.jsp.Set not found in type declaration.
Set set_Industry = null;
^
D:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_Previous__Employment__Create.java:485: Class pagecompile.jsp.Iterator not found in type declaration.
Iterator it_Industry_Elements = null;
^
D:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_Previous__Employment__Create.java:486: Class pagecompile.jsp.Iterator not found in type declaration.
Iterator it_Industry_Keys= null;
^
5 errors
Note :I have included java.util.* also as u can see in the following line.
<%@ page language="java" import="java.sql.*,java.util.*,javax.mail.*,javax.mail.internet.*,com.ess.business.*,com.ess.manager.*"%>
Any help ASAP would be appreciated.
Hari