留言板
Overriding core jsp : nothing happen
Hi,
I try to override the breadcrumb page.jsp, I followed the tutorial here :
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/overriding-core-jsps
I have no error, and i can deploy the hook in my liferay, but nothing changes, I still have the unmodified breadcrumb... I tried to emtpy liferay (and navigator) cache, but nothing changes.
My jsp is in src/main/resources/taglib/ui/breadcrumb. Here's my code :
I see my system.out.println in catalina logs, so i guess something happen, my jsp is well provided... What do I miss?
I try to override the breadcrumb page.jsp, I followed the tutorial here :
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/overriding-core-jsps
I have no error, and i can deploy the hook in my liferay, but nothing changes, I still have the unmodified breadcrumb... I tried to emtpy liferay (and navigator) cache, but nothing changes.
My jsp is in src/main/resources/taglib/ui/breadcrumb. Here's my code :
@Component(
immediate = true,
property = {
"context.id=CustomJSP", "context.name=Custom JSP Bag",
"service.ranking:Integer=100"
}
)
public class CustomJSP implements CustomJspBag {
private List<String> _customJsps;
private Bundle bundle;
/**
* Returns the directory path in the module JAR where the custom JSPs
* reside.
*
* @return the directory path in the module JAR where the custom JSPs reside
*/
@Override
public String getCustomJspDir() {
return "taglib/ui/breadcrumb/";
}
/**
* Returns the custom JSP URL paths.
*
* @return the custom JSP URL paths
*/
@Override
public List<String> getCustomJsps() {
System.out.println("*************getCustomJsps");
return _customJsps;
}
@Override
public URLContainer getURLContainer() {
return _urlContainer;
}
@Override
public boolean isCustomJspGlobal() {
return true;
}
/**
* Adds the URL paths for all custom core JSPs to a list when the module is
* activated.
*
* @param bundleContext the bundle context from which to get the custom
* JSP's bundle
*/
@Activate
protected void activate(BundleContext bundleContext) {
bundle = bundleContext.getBundle();
System.out.println("*************activate");
_customJsps = new ArrayList<>();
Enumeration<URL> entries = bundle.findEntries(
getCustomJspDir(), "*.jsp", true);
while (entries.hasMoreElements()) {
URL url = entries.nextElement();
_customJsps.add(url.getPath());
}
}
private final URLContainer _urlContainer = new URLContainer() {
@Override
public URL getResource(String name) {
return bundle.getEntry(name);
}
@Override
public Set<String> getResources(String path) {
System.out.println("*************getResources");
Set<String> paths = new HashSet<>();
for (String entry : _customJsps) {
if (entry.startsWith(path)) {
paths.add(entry);
}
}
return paths;
}
};
}
I see my system.out.println in catalina logs, so i guess something happen, my jsp is well provided... What do I miss?
David H Nebinger,修改在7 年前。
RE: Overriding core jsp : nothing happen
Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Um, this is not a JSP file, this is a java class for the tag implementation. The kind of change you want to do is not handled via a jsp override.
Come meet me at the 2017 LSNA!
Come meet me at the 2017 LSNA!
Sabrina Toulouse,修改在7 年前。
RE: Overriding core jsp : nothing happen
New Member 帖子: 21 加入日期: 15-6-9 最近的帖子
Yes this is the java class which implements CustomJspBag as they say in the tutorial.
For now my jsp only have a <h1>Hello </h1>
For now my jsp only have a <h1>Hello </h1>
Amos Fong,修改在6 年前。
RE: Overriding core jsp : nothing happen
Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
What's the full path of your override jsp?
If you're trying to override /html/taglib/ui/breadcrumb/page.jsp, then in your structure I think it would have to be:
module/.../resources/taglib/ui/breadcrumb/html/taglib/ui/breadcrumb/page.jsp
If you're trying to override /html/taglib/ui/breadcrumb/page.jsp, then in your structure I think it would have to be:
module/.../resources/taglib/ui/breadcrumb/html/taglib/ui/breadcrumb/page.jsp
Sabrina Toulouse,修改在6 年前。
RE: Overriding core jsp : nothing happen
New Member 帖子: 21 加入日期: 15-6-9 最近的帖子
I try to override portal-web/docroot/html/taglib/ui/breadcrumb/page.jsp.
And my new jsp is in the hook project, in src/main/resources/taglib/ui/breadcrumb/
I think this is what they say in the tutorial, but i must miss something, because nothing changes :/
And my new jsp is in the hook project, in src/main/resources/taglib/ui/breadcrumb/
I think this is what they say in the tutorial, but i must miss something, because nothing changes :/
Amos Fong,修改在6 年前。
RE: Overriding core jsp : nothing happen
Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
try changing getCustomJspDir() to return "resources" and putting your page.jsp in src/main/resources/html/taglib/ui/breadcrumb/
Sabrina Toulouse,修改在6 年前。
RE: Overriding core jsp : nothing happen
New Member 帖子: 21 加入日期: 15-6-9 最近的帖子
Doesn't work i got a NullPointerException on line :
while (entries.hasMoreElements()) {
while (entries.hasMoreElements()) {
Narsingh Pal,修改在6 年前。
RE: Overriding core jsp : nothing happen
Junior Member 帖子: 53 加入日期: 14-1-18 最近的帖子
Even I am facing similar issue.
I am trying to override
[indent]/html/taglib/ui/user_name_fields/page.jsp[/indent]
I have mentioned below path in my CustomJspBag Class
But nothing happens.
Any help ?
Thanks and Regards
Narsingh Pal
I am trying to override
[indent]/html/taglib/ui/user_name_fields/page.jsp[/indent]
I have mentioned below path in my CustomJspBag Class
@Override
public String getCustomJspDir() {
[b]return "META-INF/jsps/html/taglib/ui/user_name_fields";[/b]
}
But nothing happens.
Any help ?
Thanks and Regards
Narsingh Pal
Ahmed Hasnaoui,修改在6 年前。
RE: Overriding core jsp : nothing happen
New Member 帖子: 3 加入日期: 17-5-22 最近的帖子
as you need to specify the Dir try this:
and make sure you have installed the latest fix pack for GA1 as there is a bug that prevents changes to be displayed
@Override
public String getCustomJspDir() {
return "META-INF/jsps";
}
and make sure you have installed the latest fix pack for GA1 as there is a bug that prevents changes to be displayed
Jacopo Bartolini,修改在6 年前。
RE: Overriding core jsp : nothing happen
Junior Member 帖子: 28 加入日期: 17-1-19 最近的帖子
I'm sorry I cannot provide an actual answer... In fact, I've got the same issue. I'm trying to override liferay-ui:logo-selector's page.jsp, to fix a bug introduced in Liferay 7.02GA3 (issue LPS-66752). Have you find a solution?
Jacopo Bartolini,修改在6 年前。
RE: Overriding core jsp : nothing happen
Junior Member 帖子: 28 加入日期: 17-1-19 最近的帖子
Just in case, I solved my problem. Here's the solution: https://web.liferay.com/it/community/forums/-/message_boards/message/90559794