| Author |
problem to display table data in jsp using tags
|
Ratna Raju
Greenhorn
Joined: Mar 30, 2012
Posts: 3
|
|
Hi friends help me...
my jsp code is like this..
<table border="0" cellpadding="1">
<thead>
<tr>
<th>User Name</th>
<th>First Name</th>
<th>Last Name</th>
<th>Created Date</th>
<th>Email</th>
<th>Status</th>
</tr>
</thead>
<%
HttpSession ses=request.getSession();
ArrayList user=(ArrayList)ses.getAttribute("Userslist");
for(int i=0;i<user.size();i++)
{
Users u=(Users)user.get(i);
%>
<tr>
<td><%=u.getUsername()%></td>
<td><%=u.getFirstname() %></td>
<td><%=u.getLastname() %></td>
<td><%=u.getCreatedDate() %></td>
<td><%=u.getEmail() %></td>
<td><%=u.getStatus() %></td></tr>
<%}
%>
</table>
But i want write this code in tags (script less)
please help me
-Clarence
|
 |
E Armitage
Ranch Hand
Joined: Mar 17, 2012
Posts: 220
|
|
|
Start by reading JSTL page
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56531
|
|
Welcome to the Ranch!
Some hints to get you started:
In the EL, you can just use the name of any scoped variable. So within and EL expression all you need to use is UsersList. (By convention, that should be usersList. In java, variable names start with lowercase.)The JSTL's <c:forEach> tag would be used to iterate over the list.To fetch a property, drop the 'get' and lowercsase the first letter. So you can get at the username property with ${u.username} and the createdDate property with ${u.createdDate}If you need to make sure that the output is HTML-escaped (alweys a good idea for user-entered values), use the <c:out> tag.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
pravin venkat
Greenhorn
Joined: Mar 30, 2012
Posts: 20
|
|
|
http://www.coderanch.com/t/571948/JSP/java/print-values-jsp-page-fetched
|
 |
 |
|
|
subject: problem to display table data in jsp using tags
|
|
|