This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 143991 - Generate Request Scope Entity Beans and JSF pages
Summary: Generate Request Scope Entity Beans and JSF pages
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@obsolete
Depends on:
Reported: 2008-08-14 23:05 UTC by asudhir
Modified: 2010-06-24 11:10 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description asudhir 2008-08-14 23:05:41 UTC
The currently generated code for JSF pages is really good for quickly creating Session Scope Beans and supporting JSF pages.

In a typical application there will be instances where Request Scope Beans are more helpful for displaying data.

For example in a regular shopping cart application, for displaying items available under each category on a web page,
this is definitely a good use case for "request" managed beans. The only information needed to display the page is
"categoryid" and current position of records to display (for example items 15-20), which can be got by request
parameters "startpos" and "endpos".

Having a Session managed bean for this scenario would be a over burden on the server, especially if this is a high
volume site.

Continuing with Request scope beans :

Also say when the Admin user log's in, he will see "EDIT" and "DELETE" links for each of the items. For the EDIT
scenario, we just need to store this one item object in user session using "object key id" as session key. The reason
for using "object key id" as key is, user can right click on two EDIT link's and open them in separate tabs. All of them
will be in same session. One may overwrite the other object, if using single "sessionid" name.

Even in the situation, where one user deletes the item, and other user tries to access the item (say for example, add
the item to cart), then if the record does not exist in database, then it's ok to throw error back to user, indicating
item is not available. 

Also generating "Generate Request Scope Entity Beans" and corresponding pages is more helpful in combination with
"h:outputLink" tag to generate links, since everytime request parameter could be different, and users can right click in
browser and open links in separate Tabs (which are still considered as same session), and we don't have to reset any
data on server side in the controller classes (which currently persist data in global variables across user sessions).

Change Suggested : During the code generation process, it will be useful if we can provide a option (Drop Down) to use
to select which scope to use "Session" or "Request"
Comment 1 Matthew Bohm 2008-11-15 02:35:35 UTC
Addressing issue 143992 will remove the roadblock that required us to use session scope instead of request scope.

We plan to implement this request in the following manner: change the generated code such that managed beans are placed
in request scope. (We do not plan to change the wizard UI to incoporate a Request/Session dropdown.) Many thanks for
this valuable request.