Hi,
I am trying send some value from
Servlet to
JSP page, where JSP executes to show the value to the user.
I tried following code in my doGet() method of servlet:
ServletContext context = this.getServletContext();
RequestDispatcher dispatch = context.getRequestDispatcher"/HelloNewjsp.jsp");
request.setAttribute("MyName", "Swapna");
dispatch.forward(request, response);
and Following code in my JSP Page which is: HelloNewjsp.jsp
Hello <%= (
String)request.getAttribute("MyName") %>
The output i am getting on executing JSP page is : Hello null
and the output i am getting on executing Servlet is: Hello Swapna
Can anybody help me out why JSP Page is behaving like that.
I use NetBeans
IDE and
Tomcat Server.
Thanks,
Swapna.