Home > Back-end >  Fuzzy search database, the data from a great god help me fast large assignments submitted don't
Fuzzy search database, the data from a great god help me fast large assignments submitted don't

Time:09-22

<% @ page language="Java" contentType="text/HTML. Charset=utf-8 "pageEncoding=" utf-8 "% & gt;
<% @ page import="Java. SQL. *" % & gt;


<meta HTTP - equiv="content-type" Content="text/HTML. charset=UTF-8">
The homepage & lt;/title> <br/></head> <br/><body> <br/><% <br/>//query name <br/>String selectBookname=request. The getParameter (" txtSelect "); <br/>% & gt; <br/><br/><The form action="index. The JSP & gt;" <br/><H3 align='center' & gt; <br/>Please enter a name to query: & lt; Input type="text" name="txtSelect value=" https://bbs.csdn.net/topics/"<%=selectBookname==null?" ": selectBookname % & gt;"> <br/><Input type="submit" name="btnSelect" value="https://bbs.csdn.net/topics/began to query" & gt; <br/></h3 & gt; <br/></form> <br/><br/><The table border="1" width="80%" align="center" & gt; <br/><tr> <br/><td> </td> <br/><td> Books id</td> <br/><td> The title & lt;/td> <br/><td> The author & lt;/td> <br/><td> Category & lt;/td> <br/><td> Quantity & lt;/td> <br/><td> The unit price & lt;/td> <br/></tr> <br/><br/><% <br/>//connect to the database of the five parameters <br/>String driverClass=". Com. Mysql. Cj. JDBC Driver ". <br/>String serverIp="localhost"; <br/>String databaseName="zhbit"; <br/>String userName="root"; <br/>String PWD="ax191823503"; <br/>String jdbcUrl="JDBC: mysql://" + serverIp + + + "databaseName" : 3306/"? ServerTimezone=Asia/Shanghai& UseSSL=true "; <br/>String SQL="select * from test3"; <br/><br/>//read the JDBC <br/>Class.forname (driverClass); <br/>//links database <br/>Connection con=DriverManager. GetConnection (jdbcUrl, userName and PWD). <br/><br/>//if empty, instead represent the current state of the query, query all the content of the <br/>PreparedStatement ps; <br/>If (selectBookname==null) {<br/>//whether the query text box with content, if not all of the information query execution <br/>Ps=con. PrepareStatement (SQL); <br/>} else {<br/>//if there is, according to the inside of the contents of a text box in the database according to the query name <br/>Ps=con. PrepareStatement (" select * from book where bookname like?" ); <br/>Ps. SetString (1, '%' + selectBookname + '%'); <br/>} <br/><br/>//the ResultSet variable is a pointer to a database, is essentially not save any data, execute the query <br/>The ResultSet rs=ps. ExecuteQuery (); <br/>//a Boolean flag=rs. Next ();//determine whether return pointer still can continue to move down <br/>//show the serial number <br/>int i=1; <br/>While (rs), next ()) {<br/>% & gt; <br/><br/><tr> <br/><td> <% out. The print (i++); % & gt; </td> <br/><td> <%=rs. Get string (" bookid ") % & gt; </td> <br/><td> <%=rs. Get string (" bookname ") % & gt; </td> <br/><td> <Bookauthor %=rs. Get string (" ") % & gt; </td> <br/><td> <Bookcategory %=rs. Get string (" ") % & gt; </td> <br/><td> <Booknumber %=rs. Get string (" ") % & gt; </td> <br/><td> <Bookprice %=rs. Get string (" ") % & gt; </td> <br/></tr> <br/><% <br/>} <br/>% & gt; <br/></table> <br/><br/><H1 align="center" & gt; A total of & lt; %=I - 1% & gt; Record & lt;/h1 & gt; <br/><% <br/>Ps. The close (); <br/>Con. The close (); <br/>% & gt; <br/><br/></body> <br/></html> <img SRC="https://img.codepudding.com/202009/93878220518121.png" Alt=""/><p class="article - content rp"> CodePudding user response: </p>Under the load is less than class, you jars in the lib<p class="article - content rp"> CodePudding user response: </p>Whether to import the jar package, version is right<p class="article - content rp"> CodePudding user response: </p>I added the jar package I jar package is 5.1.39 <br/><img SRC="https://img.codepudding.com/202009/93878220518122.png" Alt=""/><p class="article - content rp"> CodePudding user response: </p><fieldset> <legend> reference Starry_lin reply: 3/f <legend> <blockquote> I added the jar package my jar package is 5.1.39 </blockquote> <fieldset> <br/><br/>Your link configuration is 8.0, 8.0 or to download the jar, or baidu up to 5.0 link configuration <br/><br/><p class="article - content rp"> CodePudding user response: </p>String driverClass=". Com. Mysql. Cj. JDBC Driver ". Instead of String driverClass=". Com. Mysql. JDBC Driver ";<p class="article - content rp"> CodePudding user response: </p>Write the back-end to your code, don't write on the JSP </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/20315.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/20315.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/20314.html'>Pay treasure to development mode of signature: public key certificate, or a public key, how to choos</a></div> <div class="detail-arr-right">Next:<a href='/Backend/20316.html'>At the beginning of the new writing notepad, help to see if there are any supplement.</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=Web+development' target='_blank'>Web development</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>