File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes JSP with Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "JSP with Beans" Watch "JSP with Beans" New topic
Author

JSP with Beans

bredan
Greenhorn

Joined: Dec 20, 2000
Posts: 11
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
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1
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:


Java Resources at www.wbrogden.com
Bredan Tomong
Greenhorn

Joined: Dec 21, 2000
Posts: 13
Thanks a lot.
I wonder in which way, JSP will run faster.
Since I use VisualAge, it's easy to test EJBs and JSPs.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JSP with Beans
 
Similar Threads
LazyValidatorForm and Lazy DynaBean
Jsp & beans
Servlet --> Jsp with beans
getting an array into a bean
keeping a bean alive