The Mozilla site has received a makeover. Excellent! Maybe my memory is bad, but I actually think this is one of the best looking and best structured sites I have ever seen. And hey, Firefox is their highlight product. The big old clunky Mozilla browser should be on it’s way out soon. Let the browser wars begin! 😉
Author: anderssv
J2EE testing
More on J2EE testing. Something we are figuring out on our current project. I’ll read up on it tomorrow.
Struts and Synchronizer Token
Alright, many might already know this, but it’s new to me so here goes.
I thought I had used most of the features of Struts, but I still find new features. Feature of the day: Synchronizer Token.
For those of you unfamiliar with the Synchronizer Token pattern, it ensures data can only be submitted once from a webform.
Call ActionServlet.saveToken(HttpRequest)
before the display of the form to set the token, and then check ActionServlet.isTokenValid(HttpRequest)
upon submit. If the token is valid you reset it with ActionServlet.resetToken(HttpRequest)
, which makes sure the next call to isTokenValid will fail.
I wish it was possible to set several tokens though. If a user opens more than one browser window and ends up having two forms that use the tokens open, the last form will overwrite the first forms token and thus make it fail when submitted. I know it’s a marginal case, and not one that is likely to happen very often, but I don’t think it would be a big problem to implement.