Here is my entire login class. It does, including the URL, exactly what
you want except mine said login instead of signIn:
@UrlBinding("/action/login")
public class LoginActionBean extends BaseActionBean {
@ValidateNestedProperties({
@Validate(field = "username", required = true),
@Validate(field = "password", required = true)
})
private FeedUser user;
private FeedUserService feedUserService;
public FeedUser getUser() {
return user;
}
public void setUser(FeedUser user) {
this.user = user;
}
@SpringBean("feedUserService")
public void setFeedUserService(FeedUserService feedUserService) {
this.feedUserService = feedUserService;
}
@Override
public Resolution display() {
return new ForwardResolution(LOGIN_VIEW);
}
public Resolution login() {
final FeedUser fu = feedUserService.authenticateFeedUser(user);
if (fu == null) {
getContext().getValidationErrors().add("login", new
LocalizableError("/action/login.invalid"));
return getContext().getSourcePageResolution();
}else{
getContext().setFeedUser(fu);
return new RedirectResolution(HomeActionBean.class);
}
}
}
Gregg
Akbar Ibrahim wrote:
> Gregg, Levi,
>
> Thanks for the quick responses.
>
>
>> "If a submit causes validation errors, the browser's title bar will show
>> the POST generated URL. (This can be worked around by *always*
>> redirecting after posts, as I once had to do on a previous project, but
>> that's a lot of effort for a small gain.)"
>>
>> "small gain" depends on the requirements, doesn't it? So if my client
>> wants that then the gain is substantial. Anyway, you can get the URL's
>> you desire by following my suggestions.
>>
>
> After sending my first mail I was thinking that the user is never
> going to see a POST url as I would always (ideally) be redirecting
> after POST. But (as Levi too pointed out) when validation errors
> occur, the browser shows the action bean's url.
>
> Now I am not sure if that's a big issue (for my app, not with
> Stripes). But I was just wondering if there's any way to get around
> it.
>
> Thanks,
> Akbar
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users