Other than aesthetics, what is the importance of keeping the event on the URL?
Gregg Akbar Ibrahim wrote: > To generalize this discussion, suppose I have a FooAction which does > CRUD operations with Foo objects and that it is bound to /foo > > I would have urls like > > /foo/list > /foo/view/{id} > /foo/new > /foo/edit/{id} > /foo/save > /foo/delete/{id} > > In the case of '/foo/save', the form tag will generate the url '/foo' > (save will be the name on the submit tag). Any validation errors will > cause the browser to show /foo as the url and not /foo/save. > > I don't see any way of getting around this > > Any thoughts? > > Thanks, > Akbar > > > > > > On Sun, Aug 10, 2008 at 4:28 PM, Gregg Bolinger > <[EMAIL PROTECTED]> wrote: > >> Ah, I see the difference now. You are correct. You will get a >> truncated URL because of the event being left off. Your action bean >> could handle other events than just signIn but you would always have >> signIn in the URL. So you might have: >> >> /security/user/signIn/register >> >> Which does look odd. >> >> Gregg >> >> Akbar Ibrahim wrote: >> >>> 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 >>> >>> >> ------------------------------------------------------------------------- >> 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