Second use of design patterns (memorandum patterns), design patterns memos
Our company has a very awesome girl who is one of the core figures in our project team. I usually ask her if I don't understand anything. Just yesterday we discussed a caching issue, I think in the class, the reference variable defined with static is the cache (because it was called in the previous company), and she thinks this is not, but it only exists in the memory, this is just a member variable, so he thinks it can only be called a variable. What do you think is the name of the awesome big guys?
Let's talk about the code first:
Requirement: Due to the customer's response, every time a page is deleted or edited, it always jumps to the starting page and cannot be returned to the page before their operation, therefore, I hope to have a function that allows me to perform any operations on the current page. If this page is not closed, the query conditions and pages will be retained, just as before the operation.
Thought: this is still an option. The memorandum mode starts !!
Code:
Private static Map <String, Object> map = new HashMap <String, Object> (); // defines a memorandum.
Public void remenber (OdsXsXscb odsXsXscb) {// Intercept the memorandum of use code
String flag = request. getParameter ("search"); // If the queried flag has a value, it is null.
If (odsXsXscb. getId () = null & flag = null) {// if not found
OdsXsXscb param = (OdsXsXscb) map. get (ses. getId (); // value from the memo
If (param = null) {// if there is no value in the memo
OdsXsXscb. setException ("1"); // returns the default search condition value.
} Else {// if there is a value
OdsXsXscb = param; // obtain the value in the memo and give it to the parameter.
}
} Else {// If the query is in, do not perform any operation after saving the memorandum.
Map. put (ses. getId (), odsXsXscb );
}
}
@ RequestMapping (value = "clear ")
Public void crearParam (HttpSession ses ){
Map. remove (ses. getId (); // if the window is closed, the memo record is removed.
}
I think this mode is easy to use. The original idea is to splice the data to the end of the address when it is deleted or modified, and then use the input tag to receive the data using the search criteria, and then passed in to the background, pass the value will die ..
Since I used the memorandum model, we have all agreed that, even the younger sister who has been denying me, also praised me for my clear thinking,