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> <URL-PATTERN>/PC -geetest/validate</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name> ; 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> <SERVLET-MAPPING&G
T <servLet-name>mobilestartcaptchaservlet</servlet-name> <url-pattern>/mobile-geetest/register</ url-pattern> </servlet-mapping> <welcome-file-list> <WELCOME-FILE>INDEX.HTML</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.