About get and set in STRUTS2 action.

Source: Internet
Author: User

Code:

1  Public classRandomactionextendspageaction {2     3     /**Random Extraction **/4     PrivateIrandomservice Randomservice;5     6     /**responsible Civilian police **/7     PrivateIsczrmjservice Sczrmjservice;8     9     /**Enterprise Basic Information **/Ten     PrivateIqyjbxxservice Qyjbxxservice; One      A     Privateuser user; -      -     //Private Map randommap=new HashMap (); the  -      Public voidSetrandomservice (Irandomservice randomservice) { -          This. Randomservice =Randomservice; -     } +      -      Public voidSetsczrmjservice (Isczrmjservice sczrmjservice) { +          This. Sczrmjservice =Sczrmjservice; A     } at  -      Public voidSetqyjbxxservice (Iqyjbxxservice qyjbxxservice) { -          This. Qyjbxxservice =Qyjbxxservice; -     } -  -     /** in * Get a list of randomly selected responsible police officers -      * @return to      */ +      PublicString queryrandomzrmjlist () { -         //randommap.put ("Zrmjlist", This.getrandomzrmjlist ()); the         //randommap.put ("Qyjbxxlist", This.getrandomqyjbxxlist ()); *         return"Success"; $     }Panax Notoginseng      -     /** the * Get a list of randomly selected responsible police officers +      * @return A      */ the@SuppressWarnings ("Unchecked") +      PublicList<zrmjfghy>getrandomzrmjlist () { -Actioncontext CTX =Actioncontext.getcontext (); $HttpServletRequest request =(HttpServletRequest) ctx.get (servletactioncontext.http_request); $HttpSession session=request.getsession (); -User=(User) Session.getattribute (constants.userkey); -Integer _deptid=User.getdepartid (); theZrmjfghy _getzrmj=NewZrmjfghy (); -         if(_deptid==2){Wuyi_GETZRMJ.SETGXDWBM (""); the}Else{ -_GETZRMJ.SETGXDWBM (_deptid+ ""); Wu         } -         returnsczrmjservice.getrandomzrmjlist (_GETZRMJ); About     } $      -     /** - * Get a list of random businesses -      * @return A      */ +@SuppressWarnings ("Unchecked") the      PublicList<qyjbxx>getrandomqyjbxxlist () { -Actioncontext CTX =Actioncontext.getcontext (); $HttpServletRequest request =(HttpServletRequest) ctx.get (servletactioncontext.http_request); theHttpSession session=request.getsession (); theUser=(User) Session.getattribute (constants.userkey); theString _deptcode=User.getdepartcode (); theQyjbxx _getqyjbxx=Newqyjbxx (); - _GETQYJBXX.SETGXDWBM (_deptcode); in         returnqyjbxxservice.getlistqyjbxx (_getqyjbxx); the     } the  About}
View Code

First, only the Queryrandomzrmjlist () method can be executed completely. No problem. After that, there is too much code in this method. are split into Getrandomzrmjlist () and Getrandomqyjbxxlist (). This is a sad death. Suddenly the program becomes slow. Browsers and MyEclipse will die. Worried about the dead. I can't find the reason why. After a few hours of struggle. In Get. The time of the set variable. Inspiration. Method before plus get seems to have a problem ... Because the STRUTS2 internal mechanism. So Getrandomzrmjlist () and getrandomqyjbxxlist () are executed as get and set. Two method names are changed to not after get and set start. The program runs completely without problems.

About get and set in STRUTS2 action.

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.