My intention is to display all the values in a database table and allow user to choose some rows using checkbox to delete. I displayed all values using an HTML TABLE inside a form. Its code looks like this.
File name : clean.jsp
<form action="clean.jsp" method="get">
<input type="text" name="table" value="search word">
<input type="submit">
</form>
<% try{
Class.forName("com.mysql.cj.jdbc.Driver");
java.sql.Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/amfsr","root","");
Statement st= con.createStatement();
ResultSet rs = null;
rs = st.executeQuery("select * from "+request.getParameter("table")+"
ORDER BY links DESC");
%>
<form action="clean1.jsp">
<table>
<%
while(rs.next())
{
%>
<tr>
<td><input type ="checkbox" name="checkname" value ="<%= rs.getInt("isChecked") %>" ></td> <!--isChecked is an int contains 0 by default and should become 1 when it is checked and passed to another page. from there i will delete where isChecked=1 -->
<td><input type="text" name="query" value = "<%= request.getParameter("table") %>" ></td>
<td><input type="text" name="facet" value ="<%= rs.getString("facets") %>" ></td>
<td><input type="text" name="weight" value ="<%= rs.getString("links") %>" ></td>
</tr>
<%
}
%>
</table>
<input type="submit" value = "delete">
</form>
i am getting the HTML Table format properly. but when i am selecting some items and submitting, i am getting this error
org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at
DEBUG level.
java.lang.IllegalArgumentException: Request header is too large
at org.apache.coyote.http11.InternalInputBuffer.fill
(InternalInputBuffer.java:515)
at org.apache.coyote.http11.InternalInputBuffer.fill
(InternalInputBuffer.java:504)
at org.apache.coyote.http11.InternalInputBuffer.parseRequestLine
(InternalInputBuffer.java:172)
at org.apache.coyote.http11.AbstractHttp11Processor.process
(AbstractHttp11Processor.java:1000)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run
(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run
(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Please help to how to pass only selected values to HTTP header as parameters and how to delete those selected items.
screenshot of clean.jsp execution
Aucun commentaire:
Enregistrer un commentaire