• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic