Of course, why not!

 

Stripes rocks!

 

From: Ben Gunter [mailto:gunter...@gmail.com] 
Sent: Friday, 28 January, 2011 16:41
To: Stripes Users List
Subject: Re: [Stripes-users] Stripes forms and Clean Url binding?

 

The s:form tag accepts nested s:param tags, just like s:url or s:link do.

On Jan 27, 2011 5:18 AM, "Karen" <ka...@kdeveloper.com> wrote:
> Nikolaos,
> 
> The problem I have is that I have parameterized pages that need to be both
> SEO Friendly and updatable.
> 
> Action Bean:
> @URLBinding("/user/{username=}/profile.html")
> 
> Example URL:
> /user/jane/profile.html
> 
> But <stripes:form> will generate this URL for it:
> /user//profile.html
> 
> But it needs to be:
> /user/jane/profile.html
> 
> This might be due to legacy code based on the fact that mixing GET
> parameters in the URL with a POST parameters is not allowed. But this
> limitation should not apply to the URL's we generate with @URLBindings.
> 
> -----Original Message-----
> From: Nikolaos Giannopoulos [mailto:nikol...@brightminds.org] 
> Sent: Wednesday, 26 January, 2011 21:02
> To: Karen
> Cc: 'Stripes Users List'
> Subject: Re: [Stripes-users] Stripes forms and Clean Url binding?
> 
> Karen,
> 
> My issue was with localization in that I needed a localized URI binding
but
> Stripes forced me to have one that it could resolve the URI to an
> ActionBean.
> 
> But if I understand you correctly I'm not sure your case is an issue. 
> You don't want Stripes trying to plug in parameters like "event" for
example
> which may have multiple submit buttons e.g. "Cancel" and "Continue".
> 
> And as far as the other parameters are concerned hidden form fields could
> readily supply values back on form submit.
> 
> I for one am glad that Stripes puts little effort into determining this
URL
> because it offers full freedom within my form. Again my issue was w.r.t.
to
> localization which is another animal altogether.
> 
> Perhaps this is not what you are talking about... if so... then an example
> might help ;-)
> 
> --Nikolaos
> 
> 
> 
> 
> 
> Karen wrote:
>> I like to follow-up on Nikolaos remarks about clean URLS and forms not 
>> working as expected.
>>
>> When using the <stripes:form> tag for action beans that have an 
>> @URLBinding annotation with parameters, the <stripes:form> tag ignores 
>> those parameters and thus generates an unexpected and incorrect form
> action URL.
>>
>> I'm under the impression that this could be fixed by altering the 
>> 'setBeanclass' and 'doStartTag' method on the 
>> net.sourceforge.stripes.tag.FormTag class. If these methods became 
>> aware of the parameter defined in the @URLBinding of the ActionBean it 
>> would be possible to generate a complete URL. The parameter values 
>> themselves could be 'get' from the current action bean by using the Java
> reflection API.
>>
>> This would of course only work when the action bean handling the form 
>> forwards to the JSP with the form (MVC pattern). So we might want to 
>> make this behavior optional.
>>
>> Would this be a good solution to this problem? 
>>
>>
>> -----Original Message-----
>> From: Nikolaos Giannopoulos [mailto:nikol...@brightminds.org]
>> Sent: Saturday, 20 November, 2010 23:37
>> To: Stripes Users List
>> Subject: Re: [Stripes-users] Stripes forms and Clean Url binding?
>>
>> Oops... was playing around with a number of solutions. This one won't 
>> work because it didn't solve the fact that form action="/article" is 
>> unable to hit the @UrlBinding for the ArticleActionBean.
>>
>> So far what appears to work is doing the following:
>> <s:form action="${actionBean.formUrlBinding}" method="POST">
>>
>> And then having on the action bean:
>>
>> public String getFormUrlBinding() {
>> StringBuilder sb = new StringBuilder(); 
>> sb.append("/article/").append(this.authorId).append('/').append(this.i
>> d).app
>> end('/').append(this.titleUrlified);
>> return (sb.toString());
>> }
>>
>> Still appears to be a hack as I am duplicating the @UrlBinding but at 
>> least its encapsulated in the ActionBean... if that is any solace ;-)
>>
>> Cheers,
>>
>> --Nikolaos
>>
>>
>>
>> Nikolaos Giannopoulos wrote:
>> 
>>> Hi,
>>>
>>> So I figured out a solution to the problem:
>>>
>>> <s:hidden name="authorId"></s:hidden> <s:hidden name="id"></s:hidden> 
>>> <s:hidden name="titleUrlified"></s:hidden>
>>>
>>> At first I thought it would be nice to force Stripes to build the 
>>> complete @UrlBinding i.e. it is already obviously consulting the 
>>> @UrlBinding to produce "/article" but understand why it isn't so. 
>>> Even in my case above I didn't want "event" to be the same so I guess 
>>> this offers the most flexibility... because how far do you go in 
>>> binding parameters is not black & white.
>>>
>>> Cheers,
>>>
>>> --Nikolaos
>>>
>>>
>>>
>>> Nikolaos Giannopoulos wrote:
>>> 
>>> 
>>>> Hi,
>>>>
>>>> We have the following Url binding:
>>>> @UrlBinding("/article/{authorId}/{id}/{titleUrlified}/{$event}")
>>>>
>>>> And when we direct to the following url:
>>>> /web/article////add
>>>>
>>>> It does a ForwardResolution to a form which contains:
>>>> <s:form
>>>> beanclass="org.test.ui.web.action.content.ArticleActionBean"
>>>> 
>> method="POST">
>> 
>>>> ...
>>>> <s:submit name="save" />
>>>> <s:submit name="cancel" />
>>>> </s:form>
>>>>
>>>> However the HTML output is as follows:
>>>> <form action="/web/article" method="POST">
>>>> ...
>>>> <input name="save" value="Save" type="submit" />
>>>> <input name="cancel" value="Cancel" type="submit" />
>>>> </form>
>>>>
>>>> But the action ="/web/article" isn't sufficient to hit our Url 
>>>> binding... when we click on the "save" or "cancel" buttons???
>>>>
>>>> Am I missing something obvious like in the case of addParameter on 
>>>> RedirectResolution?
>>>>
>>>> Anyone?
>>>>
>>>> --Nikolaos
>>>>
>>>> 
>>>> 
> 
> 
> 
>
----------------------------------------------------------------------------
--
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
> February 28th, so secure your free ArcSight Logger TODAY! 
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to