I am facing a strange problem.I am not able to set a value in a request using request.setAttribute() method on a jsp page so I am not able to get it on the action class .I tried and it gives null pointer exception.
Your request object in the JSP is the object forwarded from the action , but that request will end and a new request object will be created when you submit your jsp with form elements as the request attributes.
i agree to what karthik says but to me it looks like you are setting it in the request object when the page is rendered . if this is a form submit it should definitely be available in the action class . i would ensure you do a form submit . if it still a problem put a hidden field on the page and store the value during load . in that way i think you can use request.getParameter('hidden variable name').