Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem to display table data in jsp using tags

 
Ratna Raju
Greenhorn
Posts: 3
Java PHP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 989
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by reading JSTL page
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  •  
    pravin venkat
    Greenhorn
    Posts: 20
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic