I've read a lot about the same question, I tried to follow the answers but it never work.

I have a servlet name: get\_import.java
I have a jsp name: import.jsp

First, in processRequest(), i initiated a String s = "abcdef", then i wrote: 

```
s=request.setAttribute("validate", s);
RequestDispatcher rd = getServletContext().getRequestDispatcher("import.jsp");
rd.forward(request,response);

```

Then, in import.jsp, i wrote:

```
<%  String st = (String)request.getAttribute("validate");
    out.println("<h1>Result: " +st+ "</h1>");
%>

```

Then output was: Result: null

I can't explain why the variable's value is null in jsp, please help me to solve this problem or find other way out. Thanks a lot!!