• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Instantiate a bean in a servlet and latter read it from jsp .

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just bind your resultBean to request scope.
SimpleMVC on http://simple.souther.us is an example of this.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic