-java version of the procedure for verifying the use of the SDK __java

Source: Internet
Author: User
Tags git clone

I'm going to step through this step-by-step implementation of the detailed process (Java version) of the validation configuration on my own project.

First, let's take a look at the expected effect we're going to achieve:

(1), open the server, access to the landing page


(2), click the Submit button to enter the verification interface


(3), slide Verification Successful, pop-up dialog box, jump to the display interface



OK, no more nonsense, then proceed to the detailed steps:

Go to Http://www.geetest.com/install/sections/idx-server-sdk.html#java this site to look at the Java version of the SDK information, there will be a hint to https:// Github.com/geeteam/gt-java-sdk.git This SDK, the Local install git, directly using the command

git clone https://github.com/GeeTeam/gt-java-sdk.git, the download is complete after the folder to open the approximate following:


At this time we open our own project, the SDK in the SRC directory to copy all the files to their project, the effect is as follows:


Copy the login.jsp files from the SDK to our project:


At this point if we run the project and find that validation doesn't work, we have to configure the Web.xml file to copy the Web.xml files in the SDK to the project, with the following code added:

    <!--configuration Login Verification--> <servlet> <servlet-name>StartCaptchaServlet</servlet-name> & Lt;display-name>startcaptchaservlet</display-name> <description></description> <se Rvlet-class>com.geetest.sdk.java.web.demo.startcaptchaservlet</servlet-class> </servlet> < Servlet> <servlet-name>VerifyLoginServlet</servlet-name> <display-name>verifyloginser Vlet</display-name> <description></description> <servlet-class>com.geetest.sdk.jav a.web.demo.verifyloginservlet</servlet-class> </servlet> <servlet> <servlet-name>m Obilestartcaptchaservlet</servlet-name> <display-name>mobilestartcaptchaservlet</display-name > <description></description> <servlet-class>com.geetest.sdk.java.web.mobiledemo.star Tcaptchaservlet</servlet-class> </servlet> <servlet> <servlet-name>MobileVerifyLoginServlet</servlet-name> ;d isplay-name>mobileverifyloginservlet</display-name> <description></description>
    ;servlet-class>com.geetest.sdk.java.web.mobiledemo.verifyloginservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>VerifyLoginServlet</servlet-name> &LT;URL-PATTERN&GT;/PC -geetest/validate</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name&gt ; Startcaptchaservlet</servlet-name> <url-pattern>/pc-geetest/register</url-pattern> </serv
        Let-mapping> <servlet-mapping> <servlet-name>MobileVerifyLoginServlet</servlet-name> <url-pattern>/mobile-geetest/validate</url-pattern> </servlet-mapping> &LT;SERVLET-MAPPING&G
        T <servLet-name>mobilestartcaptchaservlet</servlet-name> <url-pattern>/mobile-geetest/register</ url-pattern> </servlet-mapping> <welcome-file-list> &LT;WELCOME-FILE&GT;INDEX.HTML&LT;/WELC Ome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome- File> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome -file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
At this point we run the project basically can run, then how to do the data interaction between the front and back. This is the knowledge of the servlet:

The way to get front-end data in the background is to invoke the Request.getparameter (key) method:


The results of the printing are as follows:

Background to send the data back to the front of the method is Data.put ("info", "My Test for Extreme Verification");:

The foreground gets the data and prints it:

This is the basis of the use of the method, but a basic understanding, more to be treated to deep excavation.


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.