I have a Servlet thats run and takes in data from a web page. Later on in a different set of tasks I want to access this data from a standard Java class and use the data, how would i go about this? Can I save the data anywhere for access?
I have code like this :
String name = request.getParameter("username");
And then I tried to set it as an attribute and pass it :
getServletContext().setAttribute("com.mycompany.app-param", "name");
Then in the next class I tried to access the context to get the varible, but no matter what I tried I got server error 500's, or null or Server = null. i don't think it's able to pick up the context properly :
value = getServletContext().getAttribute("com.mycompany.app-param");
Does anyone know how I can access the context created previously and get its variable?