java - Can I user ModelAttribute in parent abstract class for controllers -


example:

class commoncontroller {      @modelattribute("refs")     public list getref() {        ...     }      @modelattribute("refs2")     public list getref2() {        ...     } } 


class mycontroller extends commoncontroller {      @requestmapping("/my")     public string request() {         return "/my";     } } 

the modelattribute objects available on page?

why wouldn't recommend it?

for example - have 2 controllers create , edit.

they use same references getting through @modelattribute , instean copy past better create parent class controllers.

class referenceparentcontroller {      @modelattribute("refs")     public list getref() {        ...     }      @modelattribute("refs2")     public list getref2() {        ...     } }  class create extends referenceparentcontroller  {     ... }  class edit extends referenceparentcontroller  {     ... } 

Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -