This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
what i am required to do is, according to some condition instantiate 3 different bean in the servlet. The buisness logic is in the bean, and then i also need to know how to pass the data in the bean to the JSP's. Thanks
posted 15 years ago
Sharmila, Here is a sample code. Assume "SampleBean" is your bean's name. 1.In your servlet code "import SampleBean;" 2.Make an instance SampleBean sb = new SampleBean(); or any other bean's constructor you would like to call 3. Call the needed methods on this bean instance sb.setData("somearg"); 4. pass this bean to jsp HttpSession httpSession = request.getSession(false); httpSession.setAttribute("myBean",mb); getServletContext().getRequestDispatcher(response.encodeURL("/login/welcome.jsp"));
regds maha anna
[This message has been edited by maha anna (edited March 30, 2001).]