1. Properites load profile Web path settings
2, Commonutils.uuid ()
3. Txqueryrunner C3P0 Database Connection pool
4, Mailutil (SMTP service of mailbox to open otherwise fail connected)
5, Messageformat to complete the replacement of the placeholder
6. Encapsulate the form data into the user object user Formuser = Commonutils.tobean (Req.getparametermap (), user.class);
7. Alt+shit+s popup Menu
8. Custom exception throws Userservlet layer in UserService layer catch exception and set request domain forward to msg.jsp page
1 UserService2 3 Try {4User User =Userdao.findbycode (code);5 if(User = =NULL)6 Throw NewUserexception ("Invalid Activation Code");7 if(User.isstatus ())8 Throw NewUserexception ("You have activated, cannot be activated two times!") ");9Userdao.updatestatus (User.getuid (),true);Ten}Catch(SQLException e) { One //TODO auto-generated Catch block A Throw NewRuntimeException (e); -}
1 Userservlet2 //activation function3 PublicString Activation (httpservletrequest req, HttpServletResponse resp) {4 //System.out.println ("Activation");5 //1. Get the Activation Code6 //2, to the service activation function to activate7 //The service method may run out of exception to save the exception information to the request8 //forward to msg.jsp display9String code=req.getparameter ("Activationcode");Ten Try { One userservice.activation (code); AReq.setattribute ("Code", "Success"); -Req.setattribute ("msg", "Congratulations on activation success, please login now!") "); -}Catch(userexception e) { theReq.setattribute ("MSG", E.getmessage ()); -Req.setattribute ("Code", "Error"); - - } + return"F:/jsps/msg.jsp"; -}
9, about the conversion of SqlException IOException to new RuntimeException (e).
List of tools or API listings to be familiar with