Gregg,

Ah, now I get why it didn't work for me as I expected.

Your action bean is bound to /action/login and the event to display
the login form is called 'display' which doesn't show up anywhere in
the url. The url in the browser is the binding url of the action bean
which is what's shown in case of validatoin errors.

Whereas in my case, the action bean is bound to /security/user.

-  The url /security/user/signIn invokes the signIn method and
forwards to the signIn view.

-  The form submits to action /security/user using the following submit tag

<s:submit name="doSignIn" />

- On validation errors the browser shows /security/user whereas I was
expecting /security/user/signIn

I could bind my action bean to /security/user/signIn to achieve this,
but it wouldn't work if I want my action bean to handle events other
than signIn.

Thanks,
Akbar




On Sun, Aug 10, 2008 at 4:06 PM, Gregg Bolinger
<[EMAIL PROTECTED]> wrote:
> 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
>> Stripes-users@lists.sourceforge.net
>> 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
> Stripes-users@lists.sourceforge.net
> 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
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to