This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Tirthankar Dutta Chaudhuri
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just bind your resultBean to request scope.
SimpleMVC on http://simple.souther.us is an example of this.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic