| Author |
Instantiate a bean in a servlet and latter read it from jsp .
|
Tirthankar Dutta Chaudhuri
Ranch Hand
Joined: Feb 26, 2005
Posts: 48
|
|
How can i Instantiate a bean in a servlet and latter read it from jsp using the use bean tag . My code : ResultBean rb= new ResultBean(); rb.setaName(Acc.getName()); rb.setaIATA(Acc.getIATA()); PageContext pagecontext = JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true, 8192, true); pagecontext.setAttribute("rb", rb); //request.setAttribute("resultdata", rb); System.out.println(" hi ----in servlet ------------"+Acc.getIATA()); srd = request.getRequestDispatcher("results.jsp"); In jsp i want to use the use bean tag <jsp:useBean id="rb" class="result.ResultBean" scope="request"/> i am not getting any value in the jsp page no error is also being shown . How can i do what is required . Thanks , Tirthankar
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Just bind your resultBean to request scope. SimpleMVC on http://simple.souther.us is an example of this.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
 |
|
|
subject: Instantiate a bean in a servlet and latter read it from jsp .
|
|
|