Jquery submits a parameter request, the action deployed in struts. The return method returned value in the method is the forwarded JSP page, which cannot be redirected.

Source: Internet
Author: User

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.

Related Article

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.