• 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

JSP with Beans

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a project dealing with JSP and Beans. Some suggested to use properties (using same attribute names in both JSP and Bean), but there'll be a lot of viaribles in the beans.
My idea is passing Request to the bean so bean can get values from jsp. In JSP, access bean's method (getter) to get values from beans.
Which way is better?
Thanks
 
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
This is a very interesting question. I don't think you can flatly say one or the other is better. There are pros and cons for both - here is what occurs to me right off-hand:
Using properties with setX and getX
+ you can test the bean in a non-jsp environment
+ you write less code on the JSP side
- the generated Java code is pretty bulky
- some people find writing all those setX / getX methods annoying
Passing Request to Bean
+ you can implement logic to simplify which parameters you expect to find and the interpretation
+ using the Bean in a servlet will be simple
- you can't simulate the request for testing off line.
Bill

------------------
author of:
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.
I wonder in which way, JSP will run faster.
Since I use VisualAge, it's easy to test EJBs and JSPs.
 
reply
    Bookmark Topic Watch Topic
  • New Topic