搜索日期类型
<form id= "form1 " name= "form1 " method= "post " action= "search.jsp ">
<table width= "327 " height= "30 " border= "0 " align= "left " cellpadding= "0 " cellspacing= "0 ">
<tr>
<td width= "64 "> 产品搜索: </td>
<td width= "114 "> <input onFocus= "this.value= ' ' " name= "keyword " type= "text " value= "输入搜索关键词 " size= "15 " /> </td>
<td width= "89 "> <select name= "select ">
<option value= "dh "> 产品代号 </option>
<option value= "name "> 产品名称 </option>
<option value= "bz "> 标制 </option>
<option value= "bm "> 表面 </option>
<option value= "gongqiu "> 供求 </option>
<option value= "lid "> 产品类别 </option>
<option value= "guig "> 规格 </option>
<option value= "price "> 价格 </option>
<option value= "xn "> 性能 </option>
<option value= "caiz "> 材质 </option>
<option value= "brief "> 产品简介 </option>
<option value= "detail "> 详细信息 </option>
<option value= "place "> 所在地 </option>
<option value= "company "> 公司名称 </option>
<option value= "date "> 发布日期 </option>
</select> </td>
<td width= "57 "> <input onFocus= "this.blur() " type= "image "
src= "images/sosoa01.gif "
align= "absmiddle "
name= "submit2 " /> </td>
<td width= "3 "> </td>
</tr>
</table>
</form>
<jsp:useBean id= "db " class= "conn.DBHandle " scope= "page "> </jsp:useBean>
<%
String sql= " ";
String aselect=request.getParameter( "select ");
String keyword= " ";
ResultSet rs=null;
keyword=request.getParameter( "keyword ").trim();
if(keyword!=null && (!keyword.equals( "null ")))
{ keyword=getStr(keyword);
sql= "select * from product where ";
if (aselect.equals( "date "))
{
Date keys=Date.vauleOf(keyword);
sql=sql+aselect+ " like "+keys+ " "; }
else
{
sql=sql+aselect+ " like ' "+keyword+ " ' ";
}
}
rs=db.executeQuery(sql);
%>
HTTP Status 500 -
--------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 28 in the jsp file: /search.jsp
Generated servlet error:
E:\tomcat\work\Catalina\localhost\bzj\org\apache\jsp\search_jsp.java:103: cannot resolve symbol
symbol : method vauleOf (java.lang.String)
location: class java.sql.Date
Date keys=Date.vauleOf(keyword);
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
--------------------------------------------
Apache Tomcat/5.0.28
如何解决呀!请各位朋友帮忙。谢谢!
[解决办法]
呵呵 Date keys=Date.vauleOf(keyword); 看清楚没?? 方法名valueof拼写错了
应该是 Date keys=Date.valueOf(keyword);
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html