Struts reset () is not called before filling out a form

I got strange (and probably) wrong behavior. I tried to check the box on the page, and you know that: checkboxes with a mark are not checked in the request (only checked checkboxes)

What a list usually suggests is to override:

@Override
public void reset(ActionMapping mapping, ServletRequest request)

to reset all checkboxes to false. But in my case, this reset () is never called!

Anyone got an idea?

Thanks in advance,

mana

+3
source share
5 answers

The reset method is automatically called by the Struts framework (your observation on the correct answer by Elite Gentleman) ... that is, if you did everything according to the book.

Check the following:

  • Are you distributing an ActionForm class or something else?
  • reset , , ?
  • , , Struts ?
  • struts-config, , name action?

4.

+2

-

public void reset (ActionMapping ,                    javax.servlet.http.HttpServletRequest)

+4

.

scope = "" struts-config.xml

+1

Reset , ( reset ),

, jsp <html:reset /> reset ActionForm. .

0

The prototype method reset()is:

public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)

If we do not use the method reset(), when this time we try to open our application, then the previous values ​​will arrive automatically.
If we use this method reset(), the previous values ​​will be reset to empty values. Thus, using this method reset(), we can avoid the previous values.

0
source

Source: https://habr.com/ru/post/1732998/


All Articles