I think the logic is OK, but the validator wants to validate the form on
the manual refresh (check for a post?), but the fields on the form have not
been added to the stack, ie all by form.beans are empty when the validator
runs.

I have logic that checks for a refresh and will show an error message, but
it never gets to the check due to the validator running.

...I have a DMI validation interceptor that manipulates the location of the
xx.-validation.xml, if I test for a post I can bypass the validation and
then will show my error (don't really want to do it this way):

protected String getValidationContext(ActionProxy proxy) {
        final ActionContext context = proxy.getInvocation()
                .getInvocationContext();
        HttpServletRequest request = (HttpServletRequest) context
                .get(ServletActionContext.HTTP_REQUEST);
        if (!"POST".equals(request.getMethod())) {
            return null;
        } else if (dmiEnabled && StringUtils.isNotEmpty(proxy.getMethod()))
{
            return proxy.getActionName() + "!" + proxy.getMethod();
        }
        return super.getValidationContext(proxy);
    }

ie  http://www/../edit/myEdit!save.action
<http://www/edit/myEdit%21save.action> is not really a POST but a page
refresh, so I want to stop the validator running.

Cheers Greg

On 5 June 2018 at 10:38, Yasser Zamani <yasserzam...@apache.org> wrote:

>
>
> On 6/5/2018 1:26 PM, Greg Huber wrote:
> > I have a form with the below with a button: action:myEdit!save which
> works
> > great.
> >
> > <form name="myEdit" id="myEdit" action="/edit/myEdit.action"
> method="post">
> > ..
> > <input name="action:myEdit!save" value="Save" id="myEdit_myEdit!save"
> > type="submit">
> > </form>
> >
> >
> > But if I modify the url on the page as below
> >
> > http://www/../edit/myEdit!save.action
> >
> > and then manually refresh the page, it follows the DMI logic, ie try to
> > call the save method but does not set the parameters in the request, and
> > fails on the validator.  This returns to the input page with all the
> fields
> > blank, showing the validator errors.
> >
> > ....from the ParametersInterceptor doIntercept() the parameters are null:
> > ..
> >  HttpParameters parameters = retrieveParameters(ac);
> > ..
> >
> > Where would be the best place in the source stack to try and see why its
> > not populating the parameters?
>
> I think it's a correct behavior. Parameters should being posted to
> action either via query string or posting an HTML form (i.e. HTTP post
> method).
>
> Regards.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
> For additional commands, e-mail: dev-h...@struts.apache.org
>
>

Reply via email to