I have the following UGLY bit of code in a View Helper that I use to get
the table id and page number from the request, which I use for external
paging. (I get the page context via some internal tag libraries that
identify a bean as "Page Context Aware").
public Collection getPartialSoftwareList() {
int startPage;
String page;
ServletRequest request = pageContext.getRequest();
Map paramMap = request.getParameterMap();
for (Iterator it = paramMap.entrySet().iterator();
it.hasNext();) {
Map.Entry pairs = (Map.Entry) it.next();
String key = (String) pairs.getKey();
if (key.substring(0,2).equals("d-")) {
String[] pageArray = (String[]) pairs.getValue();
page = pageArray[0];
break;
}
}
try {
startPage = Integer.parseInt(page);
} catch (NumberFormatException ex) {
startPage = 1;
}
return softwareService.getPartialSoftwareList(startPage, 30);
}
Is there a better, cleaner way to get the table id and page number from
the request?
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user