<%@ page import="beans.HtmlQueryBean" %>
<%! String connStr, searchCondition; %>
<% if (connStr == null) { %>
<%@ include file="../checkConn.jsp" %>
<% } 
searchCondition = request.getParameter("searchCondition");
%>
<jsp:useBean id="htmlQueryBean" class="beans.HtmlQueryBean" scope="session" >
<jsp:setProperty name="htmlQueryBean" property="connStr" value="<%= connStr %>" />
</jsp:useBean>
<jsp:setProperty name="htmlQueryBean" property="searchCondition" />
<%-- Resave bean in session. Only needed for distributable application 
     where you cannot put the set property inside the use bean tag --%>
<% session.setAttribute("htmlQueryBean", htmlQueryBean); %>

<HTML>
<HEAD> <TITLE> The UseHtmlQueryBean JSP  </TITLE> </HEAD>
<BODY BGCOLOR="white">

<%  String searchCondition = request.getParameter("searchCondition"); 
    if (searchCondition != null) { 
       if (htmlQueryBean.verifyCondition(searchCondition)) { %>
          <H3>Search Results for : <I> <%= searchCondition %> </I> </H3>
          <%=  htmlQueryBean.getResult() %>
          <BR> <HR>
       <% } else { 
            searchCondition = ""; %>
            <h2>Invalid search condition </h2>            
       <%} 
    }  else 
            searchCondition = ""; %>


<B>Enter <a href="../conditionHelp.html">search condition</a>:</B>    
<FORM METHOD=get> 
<INPUT TYPE=text NAME="searchCondition" SIZE=30>
<INPUT TYPE=submit VALUE="Ask Oracle">
</FORM>
</BODY>
</HTML>
