...
All you need to know is how Tapestry converts page class names to page names (that appear in the URL). It's basically a matter of stripping off the root-package.pages
prefix from the fully qualified class name. So, for example, if you are building a login screen as a JSP, you might want to have a Tapestry page to receive the user name and password. Let's assume the Tapestry page class is com.example.myapp.pages.LoginForm
; the page name will be loginform
Wiki Markup |
{footnote}Tapestry is case insensitive, so LoginForm would work just as well.{footnote}
|
(although, since
Tapestry is case insensitive, LoginForm would work just as well), and the URL will be /loginform
.
Code Block |
controls |
true |
linenumbers |
true |
|
...
<form method="post" action=""
<input type="text" value="userName"/>
<br/>
<input type="password" value="password"/>
<br/>
<input type="submit" value="Login"/>
</form>
|
On the Tapestry side, we can expect that the LoginForm page will be activated; this means that its activate event handler will be invoked. We can leverage this, and Tapestry's RequestParameter annotation:
Code Block |
controls |
true |
linenumbers |
true |
|
public class LoginForm
{
void onActivate(@RequestParameter("userName") String userName, @RequestParameter("password") String password)
{
// Validate and store credentials, etc.
}
}
|
...
Code Block |
controls |
true |
linenumbers |
true |
|
public class ShowSearchResults
{
@SessionAttribute
private SearchResults searchResults;
}
|
...
Support for this was added in 5.3; see the notes on the configuration page.
Wiki Markup |
{scrollbar} |
Wiki Markup |
{display-footnotes}
|