Hi, I’ve put an updated version of ZIP, with missing QueryParameter annotation.
Note that you need to add TapExtModule as a submodule of your application module (use @SubModule( { TapExtModule.class } annotation) or simply copy its contents into your module. Joel Halbert wrote: > Hi Ivan, > > I'm trying out your extension, thanks, one question though: > The following class seems to be missing from the zip you linked to > below (http://wfrag.org/files/tapext.zip): > > ru.nsc.ict.catalogue.annotations.QueryParameter > > can i get it anywhere? > > Thx > Joel > > Ivan Dubrov wrote: >> Joel Halbert wrote: >> >>> Hi, >>> >>> Is it possible to have "named" page context parameters? (along the >>> lines of Wicket PageParameters). >>> >>> I would like to be able to have bookmarkable URLs but rather than >>> indexing page context parameters (in onActivate) by ordinal in a list >>> I would rather key them by name. >>> >> >> You can use Link#addParameter to add named parameters to Link and >> Request#getParameter to get parameter value. This is simple way, but >> requires some extra coding. >> >> >> I’ve wrote my simple extension to Tapestry that allows to work with >> named parameters the same way as with regular context parameters. You >> can either implement your event handlers >> (onStoreParameters/onRestoreParameters, their meaning is similar to >> onPassivate/onActivate) or use @QueryParameter annotatiton. >> >> Code: http://wfrag.org/files/tapext.zip >> >> You can use it the following way (snippet from page class): >> >> @QueryParameter >> private Integer page; >> >> The @QueryParameter works the similar way to @PageActivationContext >> annotation >> >> Since createPageLink/createEventLink and t:pagelink/t:eventlink does not >> support overriding named parameters, to generate a link with “page” >> value other than current one, you can use the following workaround: >> >> // We temporarily set page to current one, to generate proper link, >> // since we don't have a way to override parameter values >> int saved = page; >> page = newpage; >> Link link = resources.createPageLink(resources.getPageName(), false); >> page = saved; >> >> >> Also, the code does not work well for primitive types (like “int”), so >> it’s better to use wrappers. >> >> >> > -- WBR, Ivan S. Dubrov --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]