0

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.

Attachments AfterUsingDisplayTag._.jpg 47.8 KB BeforeUsingDisplayTag.jpg 48.45 KB
3
Contributors
3
Replies
12
Views
6 Years
Discussion Span
Last Post by superman1011010
0

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 :) )

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.