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: Message Board portal_header.jsp override liferay 7.1
Hello
I want to overrride portal_header.jsp in message board. Tried creating jsp fragment but it isnt working. On further analysis I found that this jsp is loaded using MBPortletHeaderJSPDynamicInclude.java. Can I override this service?
Note: portal_header.jsp is loaded in portlet head and not in portlet body content. Can I change it?
Regards
Nikhil Kapoor
Hi Nikhil,
Looking at the class, I beleive you can override it if you want to -- after all, it is an OSGI Service.
@Component(immediate = true, service = DynamicInclude.class) public class MBPortletHeaderJSPDynamicInclude extends BaseJSPDynamicInclude {
.. but, being an internal class, unless you do some OSGI tickery as David has blogged about https://community.liferay.com/blogs/-/blogs/fixing-module-package-access-modifiers you would be stuck having to make a copy of the class. It's not an ideal solution because it means that you would miss out on any future updates without manually checking for changes.
I am confused though -- you said that you can't override the jsp with a fragment. I think you might be mistaken on that point. You should be able to, but there are two types of fragments. There is a simpler one with just the bnd references, which I presume you have tried. That will not work, as you say.
The other is overriding a portal core JSP which is used for just this type of scenario: https://dev.liferay.com/de/develop/tutorials/-/knowledge_base/7-0/overriding-core-jsps
I've done this a handful of times so that should get you what you need.
Hello Andrew Jardine
Thanks for the response.
I will try and will let you know if it works.
Yes actually I want to hide the search bar coming in message board portlet header which is in portlet_header.jsp file. Somehow directly creating a jsp fragment is not working. I will try with jsp bag now.
Regards
Nikhil Kapoor
Hi Nikhil,
If all you want to do is hide the search field, why don't you just taget the node with css and set the disply to be hidden?
Powered by Liferay™