Hi, I didn't managed to get it work with @ActivationRequestParameter. I tried everything out and the last try was with @Persist and it worked, so I'm keeping that because nothing else works..
Thank you all. Regards, Morgan 2016-04-26 13:06 GMT+02:00 Barry Books <trs...@gmail.com>: > Sorry my previous response a bit short. I was on my phone. Something like > this hibernate example should work. It's better to store the query > parameters in the URL instead of the session. If you use the session > returning to the page will rerun the last query which seems a bit weird for > a web app. All the work is done in setupRender instead of onSuccess because > onSuccess ends with a redirect so no page is rendered. > > @Property > List<User> users; > > @Property > @ActivationRequestParameter > String lastName; > > @Inject > Session session; > > @SetupRender > void setupRender() { > if ( lastName != null ) { > users = session.createQuery(" from User where lastName = > :lastName").setParameter("lastName",lastName).list(); > } > } > > > > > On Tuesday, April 26, 2016, Morgan Hautman <morgan.haut...@gmail.com> > wrote: > > > Hi, > > > > The problem was that I had no get/setters in my Bean I displayed.. > > > > Now it renders well on the first page but when I click on the second > page I > > have: > > > > Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could not > > find a coercion from type java.lang.String to type java.util.Set. > > > > I think this is because the url looks like this: > > > > > http://localhost:8090/***/searchstreet.grid.pager/2?t:ac=model.Street$0040141f225/model.Street$0040868971 > > . > > .. > > > > And Tapestry thinks "model.Street$0040141f225" is a String but it should > be > > a Bean. > > > > I tried adding Serializable on my Street bean but it doesn't change the > > error. > > > > Any idea? > > > > Regards, > > Morgan > > > > > > 2016-04-25 16:05 GMT+02:00 Barry Books <trs...@gmail.com > <javascript:;>>: > > > > > Use @pageactvation context and put what's in your onSucess method in > > > setupRender > > > > > > On Monday, April 25, 2016, Morgan Hautman <morgan.haut...@gmail.com > > <javascript:;>> > > > wrote: > > > > > > > Hi, > > > > > > > > Thank you guys. > > > > I first tried the fix stated by Felix (@PageActivationContext) but it > > > > doesn't work. > > > > I then tried the ajax way Nathan provided and I have better results > but > > > my > > > > grid shows 4 pages/links but I don't see any data. > > > > > > > > I added > > > > > > > > <t:zone t:id="zoneGrid" id="zoneGrid"> > > > > <div/> > > > > <t:grid source="streets" row="street"> > > > > *[Grid here]* > > > > </t:grid> > > > > </t:zone> > > > > > > > > but still no luck, any one has a pointer? > > > > > > > > Regards, > > > > Morgan > > > > > > > > 2016-04-25 12:07 GMT+02:00 Nathan Quirynen < > > nat...@pensionarchitects.be <javascript:;> > > > > <javascript:;>>: > > > > > > > > > Hey, > > > > > > > > > > By returning "this" in the onSuccess event, a redirect happens > > > resulting > > > > > in a new request. If you want to preserve data between requests, > you > > > will > > > > > have to save it into the http session. > > > > > If you add http session persistence, the data will be available > > after a > > > > > new request. <http://tapestry.apache.org/persistent-page-data.html > > > > > > > > > > > > Simple example for your case: > > > > > > > > > > @Persist > > > > > @Property > > > > > private Set<Street> streets;|| > > > > > > > > > > > > > > > Be careful: in this case the whole streets set is saved into the > http > > > > > session and will remain there until the end of the session (or > until > > > you > > > > > remove it manually). > > > > > You could also persist the form vaues instead and then in > setupRender > > > > > event fill the trees set based on these values. > > > > > Also you can make use of PersistenceConstants.FLASH to let Tapestry > > > > remove > > > > > it from the session after first access automatically. > > > > > See more info: > > http://tapestry.apache.org/persistent-page-data.html|| > > > > > > > > > > Another option is making use of AJAX where the updated grid html is > > > sent > > > > > back in the response and updated on the client side. If you want to > > > > achieve > > > > > this you'll need to add a Zone around the grid and make your Form > > > submit > > > > > with AJAX. > > > > > > > > > > Your case: > > > > > > > > > > <t:form t:zone="zoneGrid"> > > > > > ... > > > > > <t:zone t:id="zoneGrid" id="zoneGrid" > > > > > <t:grid source="streets" row="street"> > > > > > </t:grid> > > > > > </t:zone> > > > > > <t:form> > > > > > > > > > > @Inject > > > > > private AjaxResponseRenderer ajax; > > > > > @InjectComponent > > > > > private Zone zoneGrid; > > > > > > > > > > void onSuccess() { > > > > > ... > > > > > ajax.addRender(zoneGrid); > > > > > } > > > > > > > > > > See more info: http://tapestry.apache.org/ajax-and-zones.html > > > > > > > > > > > > > > > Hope this helps u a bit. > > > > > Nathan > > > > > > > > > > > > > > > On 25/04/16 11:05, Morgan Hautman wrote: > > > > > > > > > >> Hi, > > > > >> > > > > >> I'm trying to make a make grid update when submitting a form > within > > > the > > > > >> same page. > > > > >> > > > > >> Here is the code: > > > > >> https://gist.github.com/mhautman/e178fdcca46331e1f4932b1cd7074de7 > > > > >> > > > > >> The page gets refreshed but the table/source doesn't seem to be > > > updated. > > > > >> > > > > >> Any help is greatly appreciated. > > > > >> > > > > >> Regards, > > > > >> Morgan > > > > >> > > > > >> > > > > > > > > > > > > > > >