There was a very interesting mail conversation today which I want to share. - It is/may be relevant for applications which were developped > 10 years ago and did not use PageBean-class (because it was not available this point of time). Beans had to be picked from the dispatcher.
So all users from 2011 on can skip this info...
First Question was: how can you run a page bean within an existing non-page bean as ROWPAGEBEANINCLUDE? - The answer is simple: you can just do it! The new page bean must implement IPageBean best by extending PageBean-class.
Now the problem: the bean can't be easily turned into a page bean by extending PageBean-class because there is already an inheritance tree on top of the bean that cannot be changed to page bean.
So how can you add a minimal IPageBean implementation to a non-page-bean to make it useable by ROWPAGEBEANINCLUDE?
The following is the response:
Code:
public class M20_innerUI
implements IPageBean, Serializable
{
String m_actualRootExpression;
long m_stamp = UniqueIdCreator.createCounter();
public M20_innerUI()
{
}
public String getPageName() { return "/ztest/m20_inner.xml"; }
public String getRootExpressionUsedInPage() { return "#{d.M20_innerUI}"; }
// implementation of IPageBean - reduce to minimum, no popups
@Override
public void setActualRootExpression(String rootExpression) { m_actualRootExpression = rootExpression; }
@Override
public String getActualRootExpression()
{
if (m_actualRootExpression != null)
return m_actualRootExpression;
else
return getRootExpressionUsedInPage();
}
@Override
public long getStamp() { return m_stamp; }
@Override
public void onBeforeRendering() { /* add any code */ }
// no popup management!
@Override
public ModalPopup openModalPopup(IPageBean pageBean, String title, int width, int height, IModalPopupListener popupListener) { throw new Error("Not implemented"); }
@Override
public ModelessPopup openModelessPopup(IPageBean pageBean, String title, int width, int height, IModelessPopupListener popupListener) { throw new Error("Not implemented"); }
@Override
public void closePopup(IPageBean pageBean) { throw new Error("Not implemented"); }
@Override
public IPageModifier getPageModifier() { return null; }
}
Please see this snippet as bridge to overcome this situation - but do not see this as great general strategy!
Kind regards! Björn