Home > Back-end >  Own database from the Internet to find used JSP shows a list of information code, start a table can
Own database from the Internet to find used JSP shows a list of information code, start a table can

Time:09-24

Before the table only shows three, now the table to show six, beginners hope you help me to solve my
The code shown below:
Find the JSP
<% @ page language="Java" import="Java. SQL. *, Java. IO. *, Java. Util. *" pageEncoding="utf-8" % & gt;
<%
String path=request.getContextPath();
String=basePath request. GetScheme () + "://" + request. GetServerName () + ":" + request. GetServerPort () + + "/" path;
% & gt;


Validation successful interface & lt;/title> <br/><meta HTTP - equiv="pragma" content="no - cache" & gt; <br/><meta HTTP - equiv="cache-control" content="no - cache" & gt; <br/><meta HTTP - equiv="expires" content="0" & gt; <br/><meta HTTP - equiv="keywords" content="keyword1, keyword2, keyword3 & gt;" <br/><meta HTTP - equiv="description" content="This is my page" & gt; <br/><style type="text/css"> <br/>Table {<br/>Border: 2 px # CCCCCC solid; <br/>Width: 360 px; <br/>} <br/>Td, th {<br/>height: 30px; <br/>Border: # CCCCCC 1 px solid; <br/>} <br/></style> <br/></head> <br/><body> <br/>Interface form submission jump success & lt; br> <br/><A href="https://bbs.csdn.net/topics/index.jsp" & gt; Return & lt;/a> <br/><% <br/>//driver name <br/>String driverName="com. Mysql. JDBC Driver". <br/>//database user name <br/>String userName="root"; <br/>//password <br/>String userPasswd="ax191823503"; <br/>//database name <br/>String dbName="zhbit"; <br/>//table name <br/>String tableName="book"; <br/>//connection string <br/>The String url="JDBC: mysql://localhost: 3306/" + dbName + "? Userid="<br/>+ "+ userName & amp; Password="+ userPasswd; <br/>Class.forname (". Com. Mysql. JDBC Driver "). The newInstance (); <br/>The Connection Connection=DriverManager. GetConnection (url); <br/>Statement statement=connection.createStatement(); <br/>String SQL="SELECT * FROM" + tableName; <br/>The ResultSet rs=statement. ExecuteQuery (SQL); <br/>% & gt; <br/><br> <br/><br> <br/><The table the align="center" & gt; <br/><tr> <br/><Th> <br/><% <br/>Out. Print (" books number "); <br/>% & gt; <br/></th> <br/><Th> <br/><% <br/>Out. Print (" title "); <br/>% & gt; <br/></th> <br/><Th> <br/><% <br/>Out. Print (" author "); <br/>% & gt; <br/></th> <br/><Th> <br/><% <br/>Out. Print (" categories "); <br/>% & gt; <br/></th> <br/><Th> <br/><% <br/>Out. Print (" number "); <br/>% & gt; <br/></th> <br/><Th> <br/><% <br/>Out. Print (" price "); <br/>% & gt; <br/></th> <br/></tr> <br/><% <br/>While (rs), next ()) {<br/>% & gt; <br/><tr> <br/><td> <br/><% <br/>Out. Print (rs) get string (1)); <br/>% & gt; <br/></td> <br/><td> <br/><% <br/>Out. Print (rs) get string (2)); <br/>% & gt; <br/></td> <br/><td> <br/><% <br/>Out. Print (rs. Get string (3)); <br/>% & gt; <br/></td> <br/><td> <br/><% <br/>Out. Print (rs. Get string (4)); <br/>% & gt; <br/></td> <br/><td> <br/><% <br/>Out. Print (rs. Get string (5)); <br/>% & gt; <br/></td> <br/><td> <br/><% <br/>Out. Print (rs. Get string (6)); <br/>% & gt; <br/></td> <br/></tr> <br/><% <br/>} <br/>% & gt; <br/></table> <br/><Div align="center" & gt; <br/><br> <br> <br> <br/><% <br/>Out. Print (" has shelves of books information as above - "); <br/>% & gt; <br/></div> <br/><% <br/>rs.close(); <br/>The statement. The close (); <br/>Connection. The close (); <br/>% & gt; <br/></body> <br/></html> <br/><img SRC="https://img.codepudding.com/202009/99356240140381.png" Alt=""/> <img SRC=" https://img.codepudding.com/202009/99356240140382.png "Alt=" "/> </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/25669.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/25669.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/25668.html'>Help bosses give me an idea</a></div> <div class="detail-arr-right">Next:<a href='/Backend/25670.html'>Maven project running tomcat as soon as you open the specified path error 500</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=Eclipse' target='_blank'>Eclipse</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>