cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Current Bean Instance in a JSP

alihammad
Champ in-the-making
Champ in-the-making
Ok I am sitting in a JSP and I want to get the reference(instance) of the current bean in a scriplet. Similar thing is already working in a repo.tld tag. Look at the following line of code

<r:propertySheetGrid id="document-props" value="#{DialogManager.bean.document}" 
var="documentProps" columns="1" mode="view" labelStyleClass="propertiesLabel" externalConfig="true" />

"r" is the prefix of "repo.tld" .

In above code DialogManager.bean returns the current instance of the bean.

Now I want the same thing in a scriptlet, but the problem is that how would I get the current bean reference?
I wanna do something like this

<%
DialogManager dm = get the current bean reference …

DocumentDetailsDialog ddd = (DocumentDetailsDialog)dm.getBean();
%>

Please help as I am stuck at this thing …
3 REPLIES 3

alihammad
Champ in-the-making
Champ in-the-making
Please answer this .. somebody?? I really need help

mrogers
Star Contributor
Star Contributor
scriptlets do not have a "current bean".

However scriptlet can reference a bean by name.   In the example you gave there is one called "DialogManager".

jayjayecl
Confirmed Champ
Confirmed Champ
I know this will not be an answer, but I'm pretty sure there can be a better solution than using scriptlet.
What are you trying to achieve ? Maybe we can help you do it differently ?