Win a copy of Head First Android this week in the Android forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Page Beans

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you use page beans as the model in the Model-view-controller architecture? If you have a servlet acting as the controller and it populates a bean that you want to use for dislay- say named displayBean, and the servlet forwards the request on to the display JSP, how can the JSP use the displayBean for the model as a bean? If the JSP uses the same bean with page scope, it will instantiate a new bean just for that page and not use the one from the servlet, right? I realize you could attach the bean to the request object and use request scope in the JSP, but the books I have say you should use a page bean for the model. How?
Thanks
Brian
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using a bean with only page scope for data that you want to forward does not make any sense. It should at least be request scope.
Which book is this and what is the rational for using page scope?
Bill
 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that's what I thought but I was confused by what I read. I was reading the Java Server Programming J2EE Edition from WROX. So really a page bean is only good if your JSP is using a bean and that bean does some processing to populate itself, then the JSP can call the getXXX methods of the bean to finish the display, right?
Thanks
Brian
 
reply
    Bookmark Topic Watch Topic
  • New Topic