Q: what should you use if you need mutliple instances of the servlet to share something?
A: if you want all the threads to access a value, decide which attribute state makes the most sense, and store the value in an attribute.
chances are, you can solve your problems in one of the two ways:
1)Declare the variables as local variable within the service method, rather than as an instance variable.
2) use an attribute in the most appropriate scope.
Arpit Panwar wrote:Make sure you change the Storage engine of your table to InnoDB
I think the default engine MyISAM doesnt support Transactions
Try it and let me know
Ulf Dittmer wrote:What does "it doesn't work" mean? What exactly happens if you run the code?
Bear Bibeault wrote:
wei liu wrote:which only prints 1 which should be 2.
Why would you say that? There is only one Criterions tag in the XML.