how to insert checkbox values especially image url to mysql using jsp
how to insert checkbox values especially image url to mysql using jsp
Give all checkboxes the same name
but a different value
.
<input type="checkbox" name="checkbox" value="foo">
<input type="checkbox" name="checkbox" value="bar">
<input type="checkbox" name="checkbox" value="baz">
Then you can obtain them in the servlet using HttpServletRequest#getParameterValues()
.
String[] checked = request.getParameterValues("checkbox");
You have to connect to the database, either directly via JDBC or via an ORM like Hibernate.
Then you simply issue a query or create an persist an object which stores your data.
精彩评论