• 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
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

JSP? or Bean?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 67682
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have no idea what it means to "doing it with Bean".
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
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
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
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic