This is a parameter request submitted using jquery and Ajax on the JSP page: The corresponding method is configured in struts. xml.
Basepath is the path name of the obtained current file.
$ ("# Userregist"). Click (function (){
If (isrgemail & isrgpsd ){
$. Get ("<% = basepath %>Userregist. Action",{
Email: Document. getelementbyid ("regemail"). value,
Password: Document. getelementbyid ("PSD"). Value
}, Function (data ){
Alert (data. Success );
});
} Else {
Alert ("enter the correct information! ");
}
});
Action, class, method, and result configured in struts. xml
<Action name ="Userregist"Class =" Action. registaction "method =" adduserwhenregist ">
<Result name ="Success">/JSP/registsuccess. jsp</Result>
</Action>
Method in action:
Public String adduserwhenregist (){
Logindao lgdao = new logindao ();
Lgdao. adduserwhenregist (email, password );
Mailutil = new mailutil ();
String subject = "Thanks for registration. Please verify email ";
String content = "Thank you for your zookeeper online project management system. Please click the link below to verify your email: ***** ---- zookeeper online project management ";
Mailutil. sendemail (email, subject, content );
Return "success ";
}
The last email can be sent. No error is reported. However, you cannot jump to the JSP page represented by "success.