You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dan Payne <dp...@sotx.org> on 2002/11/12 01:03:28 UTC

RE: Pager Tag Library - Broken in 4.1.12 - I've got the fixed code and with an added feature

I've had to use the pager taglib with a declared url as in:

<pg:pager url="/calendar/location.do" maxItems="10">
	<pg:param name="locationId"/>

<snip>
</pg:pager>

I'm deploying over several contexts and no context resolution was being made
by the library to the explicit url declaration That and leaving it up to the
library's default behavior didn't always produce the desired results.
Anyways, I've modified the PagerTag class to perform a context path lookup
and add that to the url path. If anyone's interested I'll pass the code
along. Also, I've already incorporated the changes needed to make it TC
4.1.12 compliant.

-Dan

I'm startin' to like this open source idea...

-----Original Message-----
From: Andrew Geery [mailto:Geery.Andrew@doc.state.sc.us]
Sent: Friday, November 08, 2002 8:14 AM
To: 'Tomcat Users List'
Subject: RE: Pager Tag Library - Broken in 4.1.12


See the following thread which explains why the problem arises and how to
fix it.

http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg67093.html

To the above solution, I made two additional changes because
1) the list of duplicated parameters on the url grew as it was paged -- e.g.
url?a=b&a=b&a=b&a=b... (I was using the <pg:param> tag)
2) after paging in list1 and going to list2 where I expected to begin paging
on the first page, I would begin paging on the page number of list1.

The modified method for the com.jsptags.navigation.pager.PagerTag class is
below.

HTH
Andrew

============================================================================
====

public int doStartTag() throws JspException {
		if (url == null) {
			url = ((HttpServletRequest)pageContext.getRequest())
				.getRequestURI();
			int i = url.indexOf('?');
			if (i != -1)
				url = url.substring(0, i);
		}
                System.out.println("url = " + url);

                itemCount = 0; // modified
                params = null; // modified
                offset = 0; //modified
		String tmp =
pageContext.getRequest().getParameter(id+OFFSET_PARAM);
		if (tmp != null) {
			try {
				offset = Integer.parseInt(tmp);
				if (offset < 0)
					offset = 0;
				if (isOffset)
					itemCount = offset;

			} catch (NumberFormatException e) {
			}
		}

		pageNumber = pageNumber(offset);
		pageNumberInteger = new Integer(1+pageNumber);

		pageContext.setAttribute(id+PAGE_NUMBER, pageNumberInteger);
		pageContext.setAttribute(id+OFFSET, new Integer(offset));
		pageContext.setAttribute(id+MAX_ITEMS, new
Integer(maxItems));

		return EVAL_BODY_INCLUDE;
	}

-----Original Message-----
From: Robert Biernat [mailto:RobertB@oopl.com.au]
Sent: Friday, November 08, 2002 2:54 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: Pager Tag Library - Broken in 4.1.12


Hi,

I'm trying to use the Pager Tag Library found at

http://jsptags.com/tags/navigation/pager/pager-taglib-1.1.html
<http://jsptags.com/tags/navigation/pager/pager-taglib-1.1.html>

in my webapp thats running on 4.1.12 and it appears that 4.1.12 has
something in it which prevents the tag from working correctly. Basically
when the page is first rendered it looks fine, until you try and page
through the records in which case it doesnt work.

Whats even worse is even after closing the browser and going back to the
page, instyead of the tag rendering correctly it stays in the samne state it
was at before the broswer was closed. Its as if the tag lib is being cached
somewhere.

Does anyone know wether 4.1.12 introduced anything that new that could be
causing it.

Also in this new version I sometimes get jasper exceptions after I redeploy
an application, but this goes away usually if i jhust hit refresh in the
browser.

I tested it in Tomcat 4.0.X and it works fine.

Has anyone else experienced this problem?

Thanks

Rob

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>