%@ page import="com.cw.search.*" %>
<%@ page import="com.cw.weather.*" %>
<%@ page import="com.cw.weather.types.*" %>
<%@ page import="com.cw.weather.reports.*" %>
<%@ page import="com.cw.util.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%
//System.out.println("here");
String cityid = request.getParameter("city_id");
String searchtext = request.getParameter("searchtext");
//if(searchtext==null) searchtext = request.getParameter("searchText2");
if(searchtext==null||"".equals(searchtext.trim())) searchtext = request.getParameter("searchText2");
boolean metric = "true".equals(request.getParameter("metric"));
List al = new ArrayList();
SearchEngine searchEngine = SearchEngineFactory.getInstance();
if(cityid!=null){
City city = (City) searchEngine.idSearch(cityid);
if(city!=null) al.add(city);
}
if(al.size()==0&&searchtext!=null){
City city = searchEngine.zipSearch(searchtext, "US");
if(city!=null) al.add(city);
if(al.size()==0){
al = searchEngine.search(searchtext);
if(al.size()==0) al = searchEngine.search("zip:"+searchtext);
}
}
if(al.size()==0){
request.getRequestDispatcher("/bin/cw/cwnotfound.jsp").forward(request, response);
return;
}
if(al.size()==1){
City city = (City) al.get(0);
%>