SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 274 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

The first form is submitted when the locale is changed, and we don't want
the validation logic to run in that case.
To solve this problem, let's use the @OnEvent annotation to run the event handlers
only when the login form is submitted. The two mentioned methods might look
similar to this:
@OnEvent(value = "success", component = "loginForm")
Object showCollection()
{
return ShowAll.class;
}
@OnEvent(value = "validate", component = "loginForm")
void validateInput()
{
User authenticatedUser =
Security.authenticate(userName, password);
if (authenticatedUser != null)
{
user = authenticatedUser;
}
else
{
loginForm.recordError(
messages.get("authentication-failed"));
}
}
Now everything should work fine, but our component still has one deficiency. It
obtains the supported locales as a parameter. They are configured exactly in the same
way in the AppModule file:
configuration.add("tapestry.supported-locales", "en,de");
Chapter 8
[ 229 ]
So why don't we just ask Tapestry to give us this information? Well, there is good
news and bad news related to this. The bad news is that at the moment there is no
simple way to obtain the information on the supported locales. Such a way should
appear very soon??”maybe it will be available by the time you be read this book??”but
right now we need to create a custom service to get access to this information.


Pages:
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6