You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mike Shoemaker <mi...@shoesobjects.com> on 2008/05/28 05:32:32 UTC
Add Parameterized Message to ExceptionReport
Gang
I'm new to tapestry and I'm currently trying to catch a duplicate
database entry(i.e. user registered twice) and I'd like to catch the
hibernate exception and forward to the Exception Report page but
instead of displaying the error message, instead I'd like to say "User
already registered" or something like that. I can't seem to find the
right terms to plug into google to get back what I need. Can someone
point me to a source that shows how to do this.
Thanks
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Add Parameterized Message to ExceptionReport
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi Mike,
I posted about how to turn the RequestExceptionHandler into a pipeline a
week or two ago:
http://www.mail-archive.com/search?q=RequestExceptionFilter&l=users%40tapestry.apache.org
You could use this approach, perhaps coupled with the Strategy service
I'm talking about in one of my posts, to do what you want.
I wouldn't recommend the approach, though. It's much better - according
to the Hibernate guys, anyhow - to check if the user already registered
during the validateForm event and display a form error if so:
@Property
private String username;
...
@Inject
private UserService userService;
...
@Component(id = "register")
private Form registerForm;
@Component(id = "username")
private TextField usernameField;
...
void onValidateFormFromRegister() {
if (!userService.isUniqueUsername(username)) {
registerForm.recordError(usernameField, "Username already taken.");
}
}
...
At least that's the way I do it. :)
-Filip
Mike Shoemaker skrev:
> Gang
>
> I'm new to tapestry and I'm currently trying to catch a duplicate
> database entry(i.e. user registered twice) and I'd like to catch the
> hibernate exception and forward to the Exception Report page but instead
> of displaying the error message, instead I'd like to say "User already
> registered" or something like that. I can't seem to find the right
> terms to plug into google to get back what I need. Can someone point me
> to a source that shows how to do this.
>
> Thanks
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org