Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
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
Terms of use hook example - Does not update jsp
Hi all,
I was creating my first hook following the documentation steps:
https://www.liferay.com/es/documentation/liferay-portal/6.2/development/-/ai/overriding-web-resources-with-hook-liferay-portal-6-2-dev-guide-en
In the last part it says:
Now there are two Terms of Use JSP files in the liferay-portal-[version]/tomcat-[tomcat-version]/webapps/ROOT/html/portal directory. One is called terms_of_use.jsp and another terms_of_use.portal.jsp. terms_of_use.jsp is your hook’s version, while terms_of_use.portal.jsp is the original. To revert back to the original, undeploy your hook. Your replacement JSP is removed, and the .portal.jsp file is automatically renamed, taking its place. You can override any JSP in the Liferay core, while retaining thew ability to easily revert your changes. However, it’s not possible to override the same JSP from multiple hooks; Liferay won’t know which version to use.
My problem is my modified jsp is not copied in the /ROOT/html/portal folder. There is only the original one. I have tried with several examples and it is the same. I have to update directly the original files and that is not a "hook philosophy".
Do you have any idea?
Thanks!
I was creating my first hook following the documentation steps:
https://www.liferay.com/es/documentation/liferay-portal/6.2/development/-/ai/overriding-web-resources-with-hook-liferay-portal-6-2-dev-guide-en
In the last part it says:
Now there are two Terms of Use JSP files in the liferay-portal-[version]/tomcat-[tomcat-version]/webapps/ROOT/html/portal directory. One is called terms_of_use.jsp and another terms_of_use.portal.jsp. terms_of_use.jsp is your hook’s version, while terms_of_use.portal.jsp is the original. To revert back to the original, undeploy your hook. Your replacement JSP is removed, and the .portal.jsp file is automatically renamed, taking its place. You can override any JSP in the Liferay core, while retaining thew ability to easily revert your changes. However, it’s not possible to override the same JSP from multiple hooks; Liferay won’t know which version to use.
My problem is my modified jsp is not copied in the /ROOT/html/portal folder. There is only the original one. I have tried with several examples and it is the same. I have to update directly the original files and that is not a "hook philosophy".
Do you have any idea?
Thanks!
Does the log file say that the hook was deployed? Please check this - if it complains about something and the hook is not deployed, there's no use in checking the code in the hook.
That being said: Is your hook available somewhere to be able to look at it? Can you make it available?
That being said: Is your hook available somewhere to be able to look at it? Can you make it available?
To add what Olaf says, does the path to your file in your hook match that of the portal?
Over and above what Olaf and David said, do also check if your liferay-hook.xml file contains <custom-jsp-dir> tag, which will look something like this -
Regards,
Nilesh
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>Regards,
Nilesh
Thanks to all for your quick responses.
When I modify the jsp I can see in the console the deploying reload.:
-------------------------
INFO: Ha comenzado la recarga de Contexto [/Ejemplos-Hook-hook]
15:43:38,268 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]][PluginPackageUtil:1016] Reading plugin package for Ejemplos-Hook-hook
16-abr-2015 15:43:40 org.apache.catalina.core.StandardContext reload
INFO: Se ha completado la recarga de este Contexto
15:43:43,980 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][HookExplodedTomcatListener:54] Modifying hook for C:\Liferay\deploy\Ejemplos-Hook-hook.xml
15:43:45,065 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:2389] Modifying Servlet 2.5 C:\Liferay\tomcat-7.0.42\webapps\Ejemplos-Hook-hook\WEB-INF\web.xml
15:43:45,066 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][HookExplodedTomcatListener:60] Hook for C:\Liferay\deploy\Ejemplos-Hook-hook.xml modified successfully
15:43:45,066 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseExplodedTomcatListener:49] Copying file C:\Liferay\deploy\Ejemplos-Hook-hook.xml to C:\Liferay\tomcat-7.0.42\conf\Catalina\localhost
----------------------------
The liferay-hook.xml is correctly parametrized:
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_1_0.dtd">
<hook>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
</hook>
Maybe some eclipse configuration?
Thanks.
When I modify the jsp I can see in the console the deploying reload.:
-------------------------
INFO: Ha comenzado la recarga de Contexto [/Ejemplos-Hook-hook]
15:43:38,268 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]][PluginPackageUtil:1016] Reading plugin package for Ejemplos-Hook-hook
16-abr-2015 15:43:40 org.apache.catalina.core.StandardContext reload
INFO: Se ha completado la recarga de este Contexto
15:43:43,980 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][HookExplodedTomcatListener:54] Modifying hook for C:\Liferay\deploy\Ejemplos-Hook-hook.xml
15:43:45,065 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:2389] Modifying Servlet 2.5 C:\Liferay\tomcat-7.0.42\webapps\Ejemplos-Hook-hook\WEB-INF\web.xml
15:43:45,066 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][HookExplodedTomcatListener:60] Hook for C:\Liferay\deploy\Ejemplos-Hook-hook.xml modified successfully
15:43:45,066 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseExplodedTomcatListener:49] Copying file C:\Liferay\deploy\Ejemplos-Hook-hook.xml to C:\Liferay\tomcat-7.0.42\conf\Catalina\localhost
----------------------------
The liferay-hook.xml is correctly parametrized:
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_1_0.dtd">
<hook>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
</hook>
Maybe some eclipse configuration?
Thanks.
Community
Company
Feedback