2013年10月5日星期六

Solving ssh2 , keep thinking

page data For example , I have an edit page , through the action of a list to get the database set before inserting or changing the database , I need to set the page on the list for CRUD operations. Because each time the page is refreshed CRUD , action inside that list could not save values. I want action inside the list collection set to static, but I heard that affect static thread-safe , try not to use the Internet is also recommended static , would like to ask is there any better way or I do not know the technique , thank you !
------ Solution ---------------------------------------- ----
in action in executing their business logic and then give the list assignment
will echo
------ Solution -------------------------------- ------------
can write a class that uniquely identifies the list with the user ( user ID, ​​or session, depending on your system configuration ) associated by adjusting list uniquely identifies the content .
class List2User {
int userid;
List list;
}

......
static List2User list;
......
------ For reference only -------------------------------- -------


Yes, but the problem is that the list has been lost before . For example, I made ​​a page increases the operation , action gave processed assignment list , I'll make an additional operation , in front of the no. . . Each call to action, private List XX = new ArrayList . . . . Defined as static with the static would be no problem, but not entirely static . Two users simultaneously , using a static variable .
------ For reference only -------------------------------------- -


wrong, is static unsafe , two users simultaneously , using a static variable .
------ For reference only -------------------------------------- -

  
Yes, but the problem is that the list has been lost before . For example, I made ​​a page increases the operation , action gave processed assignment list , I'll make an additional operation , in front of the no. . . Each call to action, private List XX = new ArrayList . . . . Defined as static with the static would be no problem, but not entirely static . Two users simultaneously , using a static variable .  
Then do not refresh the page

with ajax
------ For reference only -------------------------------- -------



This approach is good, thank you ! Have time to try !
------ For reference only -------------------------------------- -

    
Yes, but the problem is that the list has been lost before . For example, I made ​​a page increases the operation , action gave processed assignment list , I'll make an additional operation , in front of the no. . . Each call to action, private List XX = new ArrayList . . . . Defined as static with the static would be no problem, but not entirely static . Two users simultaneously , using a static variable .          
  Then do not refresh the page
  
using ajax  


Thank you, I try to use dwr framework , thank you very much !

没有评论:

发表评论