• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP? or Bean?

 
Al Lozada
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea what it means to "doing it with Bean".
 
Ajith George
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better do with jsp.

i think what they ment by 'doing with bean ' is doing the application in swing or awt.
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13044
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Al Lozada
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic