jQuery in Action, 2nd edition*
The moose likes JSP and the fly likes Jsp:useBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp:useBean" Watch "Jsp:useBean" New topic
Author

Jsp:useBean

jaffrin abdul salam
Greenhorn

Joined: Sep 16, 2005
Posts: 23
<jsp:useBean id="VRF_LIST" class="java.util.ArrayList" scope="request"/>

I am using the above line in one of my jsp page.
If the scope is request then,
is it possible to get VRF_LIST object from "request.getattribute("VRF_LIST")" that has been set in EJB.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Originally posted by jaffrin abdul salam:

is it possible to get VRF_LIST object from "request.getattribute("VRF_LIST")" that has been set in EJB.


No, that would result in a compilation failure. If however, you use:



it would work as long as the EJB set the scoped variable on the same request.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jaffrin abdul salam
Greenhorn

Joined: Sep 16, 2005
Posts: 23
Thanks!
Bear Bibeault
jaffrin abdul salam
Greenhorn

Joined: Sep 16, 2005
Posts: 23
VRF_LIST is set on EJB Like
request.setAttribute("VRF_LIST",vrflist);
vrflist is a map.This variable is set on same request.

And In the JSP I am Using
<jsp:useBean id="VRF_LIST" class="java.util.ArrayList" scope="request"/>
int size = VRF_LIST.size();

DO i have to still use
request.getattribute("VRF_LIST"); to get the attribute.?
Or It is not necessary to get the attribute usig the above line.
-------------------------------------------------------------------------
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

It will not be necessary; the <jsp:useBean> action will hook up the scripting variable populated with any existing scoped variable of that name in the request.

Again, this all depends upon whether the EJB is putting the scoped variable in the same request that your JSP page is serving.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jsp:useBean
 
Similar Threads
encountering problem in importing java bean
Error - Please Help!!!
Query reg . jsp:usebean
Error: No getter method for property
jsp:usebean type attribute