Home > Back-end >  Springboot static resource access problems
Springboot static resource access problems

Time:10-31

the contents of the code have been on the git
https://github.com/2325616550/springBoot_jibite.git

The purpose of,
Master the Servlet programming, including the Servlet to handle the request and response, the Session Session mechanism, familiar with the Eclipse/MyEclipse Java Web application framework,

Second, experiment content and design ideas
1. Design thinking
1, a function y=x * e - x on the interval (a, b) values of the definite integral, among them a, b by page form (that is, the use of parameter passing), and assumed a less than b, requires the use of numerical method for definite integral value approximation (can't use the definite integral formula to calculate), commonly used approximate calculation methods are: rectangular method, trapezoidal method, parabolic method, select one or multiple implementations, as shown in the attachments,
Term project requires the use of iterative method to realize the approximate calculation of definite integral value,
2, use the Session to realize "guess Numbers game", guess the number is a simple game, standard rules of the game is as follows:
Usually consists of two can play, one number, one to guess, the number of people to be good without A repeat number 4 digits, can't let guess people know, people can begin to guess, each guess A number, which is to A few A few B according to the number, the figures show that the location right in front of A number of Numbers, and B before digital said the number of right and wrong number,
Such as the correct answer is 5234, and 5346 people guess, is 1 a2b, one of the five position by the way, remember to 1 a, and these two Numbers 3 and 4 by the way, and location not to, so remember to 2 b, add up to is 1 a2b,
Then guess people according to ask A few A few B continue to guess again, until the guess (4 a0b) start appearing,
Subject for computer simulation of the digital side (can't repeat the 4 digits), and provide a Web page to make the game of speculation, according to the comparison results give the corresponding hints at the same time, once the user guess Numbers, shows a successful information, and give the answer and players guess the number of times,
2. The main data structure
 public interface UserService {
Boolean isUser (String name, String password);
Boolean checkName (String name);
The Integer addUser (User User);
The User getUser (String name);
}

Above is the structure of the guess Numbers game
Attribute is an int integer refers to guess the correct answer to
Then a speculation that access to the results of the method, the interface incoming players guess the number
3. The main code structure

Three controller is used to deal with 1. Points 2. Guess digital business 3. Jump of the page
A service is used to write for the logic of guesses
4. Main code analysis
 @ RequestMapping (" setNumber ") 
Public void setNumber (it the req) {
The HttpSession session.=the req getSession ();
The StringBuilder num=new StringBuilder ();
Int correctNum;
int a;
While (true) {
A=(int) (10 * math.h random ());
//the first not to 0
If (num. Length () & lt; 1) {
While (true) {
If (a==0) {
A=(int) (10 * math.h random ());
} else {
break;
}
}
}
//check repeat
Boolean isRepeat;
While (true) {
IsRepeat=false;
for (int i=0; iIf (num. CharAt (I)==(a + '0')) {
A=(int) (10 * math.h random ());
IsRepeat=true;
break;
}
}
if(! IsRepeat)
break;
}
Num. Append (a);
If (num. Length () & gt; 3)
break;
}
CorrectNum=Integer. ParseInt (num. ToString ());
Session. SetAttribute (" correctNumber correctNum);
System. The out. Println (session. The getAttribute (" correctNumber "));
}


This method is to set up the correct answer of business processing,
Because the Numbers can't repeat, separate each randomly before and have to compare if the same Numbers randomly until is different, it must be pay attention to the first digit cannot be 0.
2.
This is dealing with integral function, through the front end will form data serialization back to the back end, processing integration using iterative method,
Three, the experiment using the environment
IDEA development and Spring framework Boot


Four, the experimental steps and debugging process
1. The experimental steps
(1). First the front page to write good, here is the function of the local refresh ajax to handle this experiment requirement,
The front page display:

(2). To write code and scripts, start running
2. The test data design
(1). The page two buttons are binding to the single event, would set off the ajax local refresh the page, click

(2). The data processing of integral design
There might be 1. The integral upper and lower size is wrong, 2. Didn't fill in the data points to determine, 3. Fill in the blanks, 4. Mix the letters in digital may be unexpected situation, such as these have write a script to use regular expressions to test,
(3). Guess digital data design
May appear 1. Didn't fill in the data points confirmed, (2) fill in the blanks, (3) not filled with 4 digits, 4. Complete figures such as possible accident situation, these also are considering and checking,
3. The test results analysis,
(1). The integral data processing results
1. What all don't fill in or there are no fill out
2. Characters appears not represent data fill in
(3) appear to fill in the blank space

4. Error of upper and lower limits5.
the condition of the right(2). Guess digital data results
1. What all don't fill in or fill 4 digits
2. A non-numeric characters
3. Due to the input tags added, has solved the input may be more than 4 digits
4,
the condition of normal1). In setting up the correct digital code to add a line to the correct digital print to the console, we can find that we have to guess the Numbers,
2). The first input capacity of digital
3). The second input 1 a1b
the condition of the4). The third input
5). The fourth input the correct number
Five, the experiment summary
1. Experiment error and cause analysis of the
Experimental modal dialog appeared guess the number of the game, click on the blank area disappeared, then the query data is to add a backdrop: 'static' attributes, among them, the backdrop: "static" refers to click on the background of the blanks are not closed,
2. The experiment experience and harvest,
The Servlet is running on the server of a Java applet, it can receive the request of the client to send to come over, and the response data to the client,

Six, the appendix
Can be online to verify this experiment: http://39.100.64.245/springboot/smallFeature
















  • Related