what are the preferred ways to persist data in server in runtime-Collection of common programming errors
I have a web application which has the UI having its requests handles by Struts Action class.
Lets say that the UI sends data for 30 variables at a single request. The action class process the request and stores the 30 variables in a java object.
I need to persist the data beyond the request scope (even after the server sends response back to client for that request received, the data has to be persisted), because i have another servlet which relies on this persisted data (those 30 variables updated through UI).
Ways to persistence:
- Store it in DB
- Use JPA
- Use static variables.
- Using MQ
Which among the above would you prefer? I guess the third option doesn’t hold good.
Added Points to have a better clarity:
-
The UI sends a request (holds around 30 String variable data) for every 1 minute. For every one min, the persisted data has to be modified.
-
The another servlet which relies on this persisted data is no way
related to the request, hence i believe the session context will not be shared.