Question

I heard a web application should be as stateless as possible. But it seems to me very hard to realize this often. For instance, what if I:

  1. Process a request
  2. Redirect the user to the start page
  3. Want to display the result of the request?

If the result is a little bit more complex, then just a string which could be passed as a parameter (or I don't want to include that information via URL), then I cannot combine 2. and 3.

The only solution I can think of here is keeping the information as states in the Java program.

But that would break with the rule of a stateles web application, wouldn't it?

Was it helpful?

Solution

I heard a web application should be as stateless as possible

What? There is state everywhere in a web app, both in the client and on the server. Frameworks like Sproutcore/Ember even have components called State Managers to manage, um, the state.

The server maintains some state in a user's session (typically).

Did you hear that HTTP is stateless? That's another story, and completely true. Also, it can be a good idea to write server side components that don't share state, due to threading concerns. But neither of those points should be taken to imply that your application doesn't have state.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top