In an MVC architecture how can I pass a bean to my JSP page from my controller?

Byron Tymvios

You need to add the bean to your HttpServletRequest object using setAttribute(String name, Object yourObject); Then you need to obtain a handle to the RequestDispatcher object using the HttpServletRequest's getRequestDispatcher(String pathToJSP) method, the method accepts a String arguument which points to the resource you want to forward the request to. Once you have the RequestDispatcher object you can forward your request to your JSP page: requestDispatcher.forward(HttpServletRequest, HttpServletResponse);

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact