Gilbert Prashant Singh

Greenhorn
+ Follow
since Nov 02, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gilbert Prashant Singh

Welcome to the Ranch, Kishori! Looking forward to the book!
4 years ago
This has been a real informative thread, especially on WS security. Thanks Jimmy & Lester.
8 years ago
I worked on this problem in my project for an entire day....and right when I was about to leave for home, I finally found the solution. So thought of posting it in order to help.
To solve the onchange or onselect problem, sj:sutocompleter provides "Topics" to handle such events. So following is the right way to do it:



If you also want onselect event to work then also add:

I hope it solves the proble. Cause I simply Love this Struts2-jQuery-Plugin.
8 years ago
Another Great books...in Action series!

Congrats Authors!
9 years ago
We can have dynamic redirection of JSP pages through action classes in Struts 2 using "redirect" result in struts.xml.

E.g:
In Struts.xml, have a dynamic result such as:


In the action:


9 years ago

Ernest Friedman-Hill wrote:

Originally posted by Saurabh Agrawal:

Can anyone tell me what is the meaning of thread safe precisely ??


Imagine a Person object, with many member variables; among these are three variables that represent the street, city, and postal code where they live.
You are writing a function which prints mailing address labels.
Now, imagine that one person is moving to another city, which requires changing those three variables in one Person objects. Let's say that person has just filled in a form on the Web which lets him change his address. The Web application has to set those three variables, one after another. The first one it sets is the new street address. The city and postal code are next.
Now imagine, that just at the instant that the street address is changed, your function (running in another thread) starts to print an address label for that person. The address label includes the person's name, their new street adress, but their old city and postal code. Any mail with that label on it will never be delivered correctly!
The problem is that the address-setting operation is not thread-safe. During the short time that the Web application is changing those three fields, the Person object is in an invalid state. If another thread looks at that Person's address variables during that time, it will get incorrect information.
To make this operation thread safe, you must write the methods in such a way that the address-setting process cannot be interrupted by any other thread; while the three variables are being set, no other thread can read any of them. This can be accomplished in Java using synchronized methods.




This is a far better explanation for a beginner....and explains concisely. Loved the explanation! Thanks!