Xpage Components

Hi there, we have defined an Xpage, all good renders out components and the document data. However, what I would like is for it to render data from its actual component configured…

For Example this is the page component…

definitions:
config:
/hst:hst/hst:configurations/project/hst:pages/foundationIndex:
jcr:primaryType: hst:component
hst:referencecomponent: hst:abstractpages/base
/main:
jcr:primaryType: hst:component
hst:componentclassname: project.components.FoundationIndexPageComponent
hst:template: foundation-index-page

and in that bean it has the override…


public class FoundationIndexPageComponent extends BaseHstComponent {

	private static final Logger Log = LoggerFactory.getLogger(FoundationIndexPageComponent.class);
@Override
public void doBeforeRender(final HstRequest request, final HstResponse response) throws HstComponentException {

super.doBeforeRender(request, response);
}
}

However if I write anything to the request to grab in the FTL it does not work. No error just not available in the FTL template

For example request.setAttribute(“parent”, parentBean);

in the FTL nothing…

I do not really want to create an actual component that inherits from CommonComponent

thoughts?

Thanks
J

The class you are demonstrating should be sufficient for what you are trying to achieve.

Have you verified that parentBean is not null in your class? Try for example request.setAttribute("parent","test");
Have you verified that your ftl template is reached by printing something eg. <h1>Test</h1>
Was the template configured correctly in the repository?
Are there any errors in the logs of the application?

As you understand there are many areas where something could go wrong.
Could you troubleshoot a bit more based on the above points and get back to us? Maybe share your ftl template, your hst configuration etc.
Thanks!

Hi ya, thats what I thought, I have even gone to the length of just sending back one variable, still nto working.
No errors in the logs nothing.

If I throw an error, I get an error… but with the attributes, no worky…

In the end I have resorted to using a component.