aspose file tools*
The moose likes JSP and the fly likes JSP? or Bean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP? or Bean?" Watch "JSP? or Bean?" New topic
Author

JSP? or Bean?

Al Lozada
Greenhorn

Joined: Feb 13, 2006
Posts: 6
I'm trying to develop an application, using server-side programming, that would allow a thin client (browser) to log on to the server within a LAN to access any database of multiple-choice questions so the client can display such questions then record & submit the answers to the server for checking. I got 2 advices: one is doing it using JSP & the other is doing it with Bean. I'm a beginner in both. Can you explain the difference?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

I have no idea what it means to "doing it with Bean".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ajith George
Ranch Hand

Joined: Dec 22, 2005
Posts: 109
Better do with jsp.

i think what they ment by 'doing with bean ' is doing the application in swing or awt.


SCJP 1.4, Brainbench
LinkedIn - Blog
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1016
JSPs are basically dynamic web pages. You use them to present your view to the user. So you will have a JSP for displaying a question.

Bean is the generic term given to java objects that encapsulate data. To be a bean it has to meet certain criteria (public parameterless constructor, serializable, uses get/set methods to define access to properties)

You use both when writing a web application.
Beans encapsulate the information for the application.
JSPs use the beans to generate the html pages.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12683
    
    5
Let me add my favorite thing about beans - if designed properly they can be tested outside the servlet/JSP environment. Sooo much easier because you dont have to deal with bean code errors and JSP coding errors at the same time.
Bill
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Echoing what others have written, there's a continuum here.

At one end, one can write "just" JSP, containing scriptlets or jdbc tags that do everything: connect to the database, select data, display it, update, etc...

At the other end, you use a presentation framework, like Struts or JSF, etc... where you still write JSP, but it encompasses just the presentation layer -- it accesses beans that represent a quiz question, for example.

Somewhere in the middle you might not being using a presentation layer, but you still avoid adding anything that doesn't belong in the presentation layer in your JSP -- usually beans have been set from a servlet that forwards to this page to display the result.


There is no emoticon for what I am feeling!
Al Lozada
Greenhorn

Joined: Feb 13, 2006
Posts: 6
Originally posted by Bear Bibeault:
I have no idea what it means to "doing it with Bean".


I'm sorry but I meant JavaBean.
Al Lozada
Greenhorn

Joined: Feb 13, 2006
Posts: 6
Originally posted by Ajith George:
Better do with jsp.

i think what they ment by 'doing with bean ' is doing the application in swing or awt.


Thanks for the reply. I think so.
Al Lozada
Greenhorn

Joined: Feb 13, 2006
Posts: 6
Originally posted by Stefan Evans:
JSPs are basically dynamic web pages. You use them to present your view to the user. So you will have a JSP for displaying a question.

Bean is the generic term given to java objects that encapsulate data. To be a bean it has to meet certain criteria (public parameterless constructor, serializable, uses get/set methods to define access to properties)

You use both when writing a web application.
Beans encapsulate the information for the application.
JSPs use the beans to generate the html pages.


Thanks a lot for a very comprehensive reply. I think I can start from here.
Al Lozada
Greenhorn

Joined: Feb 13, 2006
Posts: 6
Originally posted by William Brogden:
Let me add my favorite thing about beans - if designed properly they can be tested outside the servlet/JSP environment. Sooo much easier because you dont have to deal with bean code errors and JSP coding errors at the same time.
Bill


Thanks a lot. This sounds very interesting!
Al Lozada
Greenhorn

Joined: Feb 13, 2006
Posts: 6
Originally posted by Jeff Albertson:
Echoing what others have written, there's a continuum here.

At one end, one can write "just" JSP, containing scriptlets or jdbc tags that do everything: connect to the database, select data, display it, update, etc...

At the other end, you use a presentation framework, like Struts or JSF, etc... where you still write JSP, but it encompasses just the presentation layer -- it accesses beans that represent a quiz question, for example.

Somewhere in the middle you might not be using a presentation layer, but you still avoid adding anything that doesn't belong in the presentation layer in your JSP -- usually beans have been set from a servlet that forwards to this page to display the result.


Thank you so much for giving me a broader perspective!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP? or Bean?
 
Similar Threads
There can be only one Stateful Session Bean per EJB Client
Urgent: Howz stateful diff frm entity beans
Accessing Entity Beans by JSP client in Weblogic 6.1
Accessing Entity Beans by JSP client in Weblogic 6.1
Specifying local and network "mode"