aspose file tools*
The moose likes JSP and the fly likes problem to display table data in jsp using tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem to display table data in jsp using tags" Watch "problem to display table data in jsp using tags" New topic
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
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Start by reading JSTL page
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

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.


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    pravin venkat
    Greenhorn

    Joined: Mar 30, 2012
    Posts: 20
    http://www.coderanch.com/t/571948/JSP/java/print-values-jsp-page-fetched
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: problem to display table data in jsp using tags