>>>>> "Struts" == Struts Newsgroup <(@Basebeans.com) <[EMAIL PROTECTED]>> writes:

    Struts> Subject: Getting a value from the request object for variable for a custom 
tag?
    Struts> From: "Preston Crawford" <[EMAIL PROTECTED]>
    Struts>  ===
    Struts> I'm writing a custom pager for a resultset my company needs to page 
through.
    Struts> I don't return every record, just the amount and set indicated by page size
    Struts> and page number in the query. But I also want to return the total number
    Struts> found.

    Struts> So what I do, is in my action I make two calls..

    Struts>         request.setAttribute("ARRAYLIST_OF_STUFF", myCollection);
    Struts>         request.setAttribute("NUMBER_FOUND", intFound);

    Struts> Now in the JSP page I forward to I retrieve ARRAYLIST_OF_STUFF to iterate
    Struts> using the logic:iterate tag. However, here is the tricky part. I want to 
use
    Struts> the number found as part of the pager tag. The reason being that the pager
    Struts> tag needs to know how many records were found in order to produce the
    Struts> following....

    Struts> 1-10  |  11-20 |  21-30..... etc...

    Struts> So how do I get the value in my custom tag?

    Struts> I've tried the following...

    Struts> <pager:pager currentPage="2" pageSize="10" totalResults="<%=(Integer)
    Struts> request.getAttribute("NUMBER_FOUND")%>" url="participantSearch.do">

    Struts> ..but that doesn't work. What works? Or am I approaching this entirely
    Struts> wrong?

Whenever you say "that doesn't work", it would help if you say what happens.

One minor change that might help is making sure your quotes nest properly.
This would mean changing the quoting around the "totalResults" attribute to be
a pair of single quotes, instead of double quotes.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to