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 stuff Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP stuff" Watch "JSP stuff" New topic
Author

JSP stuff

Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
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.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
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
Mark Donaghue
Greenhorn

Joined: Apr 01, 2001
Posts: 29
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP stuff