用一个javascript函数就得了
if(   )
%><script="javascript">
alert("您的查询条件不足,没有结果")
</script>
<%else

解决方案 »

  1.   

    <%
    if(!条件||xxx.equals(""))
    {%>
    <jsp:forward page="ss.jsp">
    <%}%>ss.jsp:您的查询条件不足,没有结果
      

  2.   

    <html>
    <head>
    <title>查询结果</title>
    <link rel=stylesheet href="style.css" type="text/css">
    </head>
    <body>
    <%@ include file="top.htm" %>
    <%@page contentType="text/html;charset=GB2312"
        import="java.sql.*"
    %>
    <%
    String hy=new String(request.getParameter("hangye").getBytes("iso-8859-1"));
    if(hy=="-按行业-")
    {%>
    /*response.sendRedirect("wrong.jsp");*/
    <%@ include file="wrong.html" %>
    <%}
    else
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:hbmp");
    Statement smt=con.createStatement();
    String sql; 
     String hangye=new String(request.getParameter("hangye").getBytes("iso-8859-1"));
     String price=new String(request.getParameter("price").getBytes("iso-8859-1"));
     String area=new String(request.getParameter("area").getBytes("iso-8859-1"));
     String chanpin=new String(request.getParameter("chanpin").getBytes("iso-8859-1"));
     String name=new String(request.getParameter("name").getBytes("iso-8859-1"));
     sql="select * from qy where hy='"+hangye+"'";
     ResultSet rs=smt.executeQuery(sql);
     out.println("<center><br><br><br><table border=0>");
     out.println("<tr bgcolor='yellow'><th>编号</th><th>公司名称</th><th>产品名称</th><th>品牌名称</th><th>奖项名称</th><th>获奖年份</th><th>所属地区</th><th>所属行业</th><th>明细</th></tr>");
     while(rs.next())
     out.println("<tr><td>"+rs.getString(1)+"</td><td>"+rs.getString(2)+"</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(5)+"</td><td>"+rs.getString(8)+"</td><td>"+rs.getString(6)+"</td><td>"+rs.getString(9)+"</td><td>"+rs.getString(7)+"</td><td>"+rs.getString(10)+"</td></tr>");
     out.println("</table></center><br><br><br>");
     con.close();
    }
    catch(Exception e)
    {System.out.println(e.getMessage());}
    }
    %>
    <%@ include file="bottom.htm" %>
    </body>
    </html>
    以上是我的代码,
    可是if 语句不发生作用,没有重定向文件,而总是执行else里的代码,这是为什么,各们大哥,帮一下吧,急用呀
      

  3.   

    先将你传来的hy打印出来,看是否有结果。然后
    if(hy.equals("-按行业-"))试一下。