• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

JSP stuff

 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a few uncleared points about jsp:useBeans.
First, beans that have scope of "session" or "application" can persist throughout a session. So what effect does that have on using HttpSession object? What are "session beans" and "application beans" equivalents in servlets?
Do they just place a session bean inside a HttpSession object?
Secondly, when is proper to use <jsp.useBean getProperty id="someBean" Property="Tree"/> and when to use <%someBean.getTree()%>?
Overall, I feel that JSP is much simpler and flexible than servlets.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Cameron Park:
What are "session beans" and "application beans" equivalents in servlets?


The following JSP code:

Has the following servlet equivalent:

You can set attributes to create new beans.

Secondly, when is proper to use <jsp.useBean getProperty id="someBean" Property="Tree"/> and when to use <%someBean.getTree()%>?


Arguments about this sometimes verge on the religious debate. The former is just a slightly more verbose, tag-based version of the latter. I personally tend to favour the tag, because I think moving Java out of the JSP is a Good Thing.

Overall, I feel that JSP is much simpler and flexible than servlets.


Depending on what you want to do, it can be a lot simpler. But it also can encourage incredibly sloppy coding.
- Peter
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In line with that, the latest reference implementation of the Java Pet Store almost completely removes java code from JSP, relying on tags. The bluprints recommend using JSP for the view portion, and Servlets for the controller portion.
Regards,
Mark
 
My pie came with a little toothpic holding up this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic