Hi folks,
This is my first post on DaniWeb
Im trying to build an enhancement to my web app, by including pagination to diplay the results of a query in the jsp. I ve tried using the diplay tag library to implement the same .Before using the display tag library , I was just printing the List by using jstl tags and EL , something of the nature below.

<TABLE WIDTH="75%" BORDER="1">
	<TR>

		<TD>Code</TD>
		<TD>Description</TD>
		<TD>IsActive?</TD>
		<TD>IsEditable?</TD>
		<TD>Edit</TD>
		<TD></TD>

		<c:forEach items="${dao.domList}" var="dl">

			<TR>
				<TD><c:out value="${dl.code}" /></TD>
				<TD><c:out value="${dl.description}" /></TD>
				<TD><c:out value="${dl.statusActive}" /></TD>
				<TD><c:out value="${dl.statusEdit}" /></TD>
				<TD><a href="Main.jsp?${dl.objid}" onclick="selectobjID(${dl.objid})">Edit </a>  </TD>
			</TR>
		</c:forEach>
	</TR>
</TABLE>

which shows the following output
Code Description IsActive? IsEditable? Edit
SINGLE FEMALE Yes No Edit
SINGLE MALE Yes No Edit
MARRIED MALE Yes Yes Edit
where 'Edit' is a hyper link.


I did look at a couple of samples of display tag library and modified my code to the following.

<TABLE WIDTH="75%" BORDER="1">
	<TR>

		<TD>Code</TD>
		<TD>Description</TD>
		<TD>IsActive?</TD>
		<TD>IsEditable?</TD>
		<TD>Edit</TD>
		<TD></TD>
<%System.out.println("I think domList is being accessed");%>
		
			<display:table id="domList" name="${dao.domList}"pagesize="2">  
		<c:forEach items="${dao.domList}" var="dl">
			<TR>
				
			   <TD> <display:column  value="${dl.code}" /> </TD>
        		<TD><display:column  value="${dl.description }"/> </TD>
        		<TD><display:column  value="${dl.statusActive }"/> </TD>
        		<TD><display:column  value="${dl.statusEdit}"/> </TD>
                        <TD><a href="Main.jsp?${dl.objid}" onclick="selectobjID(${dl.objid})">Edit </a>  </TD>
  			</TR>
			
		</c:forEach>
</display:table>  

	</TR>
</TABLE>

However , now when I try to print the results, I get a weird output . As the records are repeated horizontally across the across the table defined in addition to the normal vertical listing.
also, the records are not listed accordint to the table structure that I have defined.
The output here is.
7 items found, displaying 1 to 2.[First/Prev] 1, 2, 3, 4 [Next/Last]
Code Description IsActive? IsEditable? Edit
SINGLE FEMALE Yes No SINGLE MALE Yes No MARRIED MALE Yes Yes MARRIED FEMALE Yes Yes Married Male Yes No Married Female Yes No Married Female Yes No
SINGLE FEMALE Yes No SINGLE MALE Yes No MARRIED MALE Yes Yes MARRIED FEMALE Yes Yes Married Male Yes No Married Female Yes No Married Female Yes No

And the hyper link associated with 'Edit' is not being displayed either :(.
Ive also attached screen shots to further illustrate my problem
Any help would be appreciated.
Thank you.

It is my understanding that these JSTL tags are used without need for html table tags like here. (If I'm wrong somebody correct me, didn't use JSTL since university :) )

Thanks for replying peter, Yes and your right , theres no need for html tags . I solved my issue too .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.