Questions about encapsulating form forms in Struts2

Source: Internet
Author: User

@Component ("User") @Scope ("Prototype") Public classUseractionextendsActionsupportImplementsModeldriven {PrivateUserregisterinfo info =NewUserregisterinfo (); PrivateUsermanager um; PrivateList<user>users;  PublicUsermanager getum () {returnum; } @Resource (Name= "Usermanager")     Public voidsetum (Usermanager um) { This. um =um; } @Override PublicString Execute ()throwsException {User u=NewUser ();        U.setusername (Info.getusername ());        U.setpassword (Info.getpassword ()); if(Um.exists (U)) {return"Fail";        } um.add (U); return"Success"; }     Publicuserregisterinfo GetInfo () {returninfo; }     Public voidsetInfo (userregisterinfo info) { This. info =info; }        //@Override     PublicObject Getmodel () {returninfo; }         PublicString list () { This. Users = This. Um.getusers (); return"List"; }         PublicList<user>getusers () {returnusers; }     Public voidSetusers (list<user>users) {         This. Users =users; }        }

Realize

Implements Modeldriven This interface, in the JSP page can not add xxx.username, directly write username can

Questions about encapsulating form forms in Struts2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.