开发者

Extract ID from Tapestry URLs

开发者 https://www.devze.com 2023-01-05 11:07 出处:网络
I have a tapestry url that looks like http://localhost:88开发者_如何学JAVA88/forwardtask/88 how do i get the 88 bit? thanks. Tapestry is such a pain to useHave a look at the page navigation sectio

I have a tapestry url that looks like

http://localhost:88开发者_如何学JAVA88/forwardtask/88

how do i get the 88 bit? thanks. Tapestry is such a pain to use


Have a look at the page navigation section in the Tapestry 5 docs, particularly Page Activation.

Effectively, you'll want this in your page class:

void onActivate(long forwardTaskId) {
    ...
}

This bit will execute before the page renders if there is a parameter in the URL.

Tapestry has some non-obvious concepts that you'll have to understand to be effective, but it's not rocket science. Good luck!


If you are using a newer version 5.1 Tapestry you can just create a variable like:

@PageActivationContext
int myNumber


typically (althought I dont know all the cases) paths in Tapestry are defined by OnActivate and onPassivate and they are generated by event context clicks (pagelink,actionlink,eventlink). check the context elements in the .tml your coming from and then look at the Active and Passive methods on the page your going to.

0

精彩评论

暂无评论...
验证码 换一张
取 消