William,

What population strategy are you using?  That's definitely going to drive
the method for clearing out bean fields.

-- Rick

On Wed, Jul 22, 2015 at 11:54 AM, William Krick <kr...@3feetunder.com>
wrote:

> @Andy
> This is an existing large project in a production environment.  So I can't
> change the population strategy at this point.  The risk of introducing new
> and exciting bugs it too great.  One of the comments on StackOverflow
> suggests using RedirectResolution instead of ForwardResolution but I'm not
> sure if that's a viable option given the existing code I'm modifying.
>
> @Rick
> I've already tried doing exactly as you suggest, setting the value to
> null, but it doesn't work.
>
> On Wed, Jul 22, 2015 at 11:45 AM, Rick Grashel <rgras...@gmail.com> wrote:
>
>> Hi William,
>>
>> All you should need to do is just set the actual variable to null in the
>> action bean before you return the resolution.
>>
>> So let's say the name of the control on the search form was "firstName".
>> That means that in the event handler method, you would have this line of
>> code:
>>
>> this.firstName = null;
>> return new ForwardResolution( "/whatever_page.jsp" );
>>
>> If it is a nested property on a first class object, then you can do
>> something like this:
>>
>> searchCriteria.setFirstName( null );
>> return new ForwardResolution( "/whatever_page.jsp" );
>>
>> That should do what you are looking for.  Hope this helps.
>>
>> -- Rick
>>
>>
>>
>> On Wed, Jul 22, 2015 at 10:14 AM, William Krick <kr...@3feetunder.com>
>> wrote:
>>
>>> I have a situation where I'm submitting a form with search parameters,
>>> performing a database search, and forwarding to the same page with the
>>> results of the search displayed in a table beneath the form input fields
>>> with all the search parameters.  Pretty standard stuff, really.
>>>
>>> The problem I'm having is that there's a radio button group (and
>>> possibly a few other fields) on the form that I would like to clear after a
>>> successful search but I can't figure out how to do it.  Setting the various
>>> values to null in the ActionBean before returning the ForwardResolution
>>> isn't working.
>>>
>>> I also tried doing this, which didn't work either...
>>>
>>> getContext().getRequest().setAttribute("assignToSelection", null);
>>>
>>> What's the correct way to clear form values in the action bean?
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Stripes-users mailing list
>>> Stripes-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Stripes-users mailing list
>> Stripes-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>>
>>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to