Ssh+jquery+ajax Wonderful Integration

Source: Internet
Author: User

Recently learned the integration of SSH2 (Struts2+spring+hibernate), began to try to write a landing interface, the results found: If you just use Struts2 to page jump, the effect of the page is not good, but also can not be local refresh (that is, asynchronous commit validation).

So, I began to search for solutions on the Internet, some say through a hidden iframe to achieve the effect, when I always feel trouble and not practical. Later asked the teacher, told me to use Ajax to achieve the desired effect, I found there are many examples of the internet is Ajax, but the lack of SSH2 (integrated) and AJAX integration (Ajax using the jquery framework).

Tell me about the effect I want:

    1. Login Page Click Submit after the background verification;

    2. Validation successfully jumps to index. JSP;

    3. Validation fails to execute a jquery script on this login page to prompt the user;

Required Packages:

In addition to the packages used by SSH2, the following packages are required for struts2:

Commons-beanutils-1.8.0.jar

Commons-collections-3.1.jar

Commons-fileupload-1.3.1.jar

Commons-io-2.2.jar

Commons-lang-2.4.jar

Commons-lang3-3.1.jar

Commons-logging-1.1.3.jar

Ezmorph-1.0.6.jar

Freemarker-2.3.19.jar

Json-lib-2.3-jdk15.jar

Ognl-3.0.6.jar

Struts2-core-2.3.16.3.jar

Struts2-json-plugin-2.3.16.3.jar

Xwork-core-2.3.16.3.jar

OK, start the code:

login.jsp


Struts.xml

<?xml version= "1.0" encoding= "UTF-8"? > <struts>    <!- This is the package -->    <package name= "struts"  extends= to configure struts when we configure SSH Struts-default ">       <action name=" Login "class=" LoginAction " >       </action>    </package>     <!-to allow Ajax to invoke action  in spring to configure Ajax package -->    < Package name= "Ajax_json"  extends= "Json-default" >    <!-the ID of this place is ajax  The value of the URL, class refers to the id-->        <action  of the spring  configuration action Name= "Login"  class= "loginaction" >             <result name= "Success"  type= "JSON"/>        < /action>    &nbsP;         </package></struts> 


Other SSH2 framework integration does not need to be changed so that the jquery framework of Ajax integration into the SSH2 framework to use!

The above content personal remarks, if there is something wrong, please pay attention to ... I will try to correct!

Well, I wish you all a happy!


This article is from "Lazy cat" blog, please be sure to keep this source http://lazycat0102.blog.51cto.com/8938702/1587187

Ssh+jquery+ajax Wonderful Integration

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.