I have this code:
<sql:query var="result"
sql="select column_name from information_schema.columns where table_name='userdb';"
/>
What does result
store and how can I use it to retrieve my data?
The <sql:query>
documentation explains what's inside the result
variable:
The type of the scoped variable is javax.servlet.jsp.jstl.sql.Result
The javax.servlet.jsp.jstl.sql.Result
is a sort of wrapper over a java.sql.ResultSet
and has methods to get to the rows of data . It's then just a matter of <c:forEach>
ing the rows. See here for an example.
PS Unless used for prototyping your application, using JSTL's SQL tags to access the database from within the JSP is discouraged.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.