简体   繁体   中英

JSTL: How to access table row contents using index

My question is: How can I access row information using index in JSTL? i am using MySQL 5.1.47 Server as Relational Database Server

For example,
I have a table name login with two attributes “ username ” & “ password ” and this table contain 10 records. I want to extract only first record information. How can I do this? I have checked on many website and could find only one way to iterate through table using For Each Tag, as follow

<c:forEach var="row" items="${query1.rows}">
<c:set var='dbUserName' value="${row.loginID}"/>  
<c:set var='dbUserPassword' value="${row.password}"/>  
</c:forEach>  

Using For Each is not helpful in accessing row information by index . Kindly Suggest or let me know if there is a very good resource on JSTL Database funcationality.
Thanks in advance

根据支持对象,您可能可以使用简单的数组索引,例如:

${query1.rows[0].loginID}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM