Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: JSP customization error when using 'OSGi fragment' approach
I'm attempting to customize the UI of the 'Documents & Media' Liferay portlet on an 'OSGi Fragment' approach, but a compilation error has arisen in one of the .jsp files I have to customize.
To tackle the intended task, I've created a Liferay Module Fragment project, and I've copied the original /document_library/view.jsp file from Liferay Portal source. This file contain an 'include' directive to include the file document_library/init.jsp. This file contains the following code:
<%
...
DLAdminDisplayContext dlAdminDisplayContext = dlAdminDisplayContextProvider.getDLAdminDisplayContext(request, response);
DLAdminManagementToolbarDisplayContext dlAdminManagementToolbarDisplayContext = dlAdminDisplayContextProvider.getDLAdminManagementToolbarDisplayContext(request, response);
...
%>
But this code displays the following error message:
dlAdminDisplayContextProvider cannot be resolved
which makes sense as the dlAdminDisplayContextProvider object is not declared in this file but within the file /init.jsp file, included by means of a 'include' directive:
<%
...
DLAdminDisplayContextProvider dlAdminDisplayContextProvider = dlWebComponentProvider.getDLAdminDisplayContextProvider();
...
%>
My question is why this error message occurs if I'm using some .jsp files belonging to a functional Liferay portlet. Can anyone explain to me why the dlAdminDisplayContextProvider object is not accesible from the document_library/init.jsp file? Any clarification would really be appreciate.
Thanks in advance.
You might need to exclude the internal packages (all those display context classes are internal) in your bnd file: It's mentioned in the article you linked, here.
With JSP fragment bundles, they only have visibility on what you put in the fragment. Any errors, any unknown references, the IDE is going to report them all as errors.
It's up to you, the developer, to know that, for example,
dlAdminDisplayContextProvider
will be available when it
is merged into the host bundle.
Powered by Liferay™