Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sawi _
add js to jsp in hook
March 14, 2012 3:32 AM
Answer

sawi _

Rank: Regular Member

Posts: 147

Join Date: March 27, 2009

Recent Posts

Hello
Hi i can add my script.js to jsp ? I create hook to change behavior on jsp and I want to add my script.js to jsp.
how I should add this file , where I should put it in hook project?
I try put it in:
WEB-INF/js/script.js
and import it in jsp by:
<c:import url="/js/floating-gallery.js" />
but it;s not working.

Abybody can help me ?

Regards
Darek
Venkat Koppavolu
RE: add js to jsp in hook
March 14, 2012 4:08 AM
Answer

Venkat Koppavolu

Rank: Junior Member

Posts: 85

Join Date: July 25, 2010

Recent Posts

1. liferay-hook.xml
<hook>
<custom-jsp-dir>/custom_jsps</custom-jsp-dir>
</hook>

2. placed your own js file at html/js/<filename>.js
Ex: html/js/floating-gallery.js

3. include your js from your jsp(which we are trying to customize).
<script type="text/javascript" src="/html/js/foating-gallery.js"></script>

Check the attached file for your reference.
Attachment

Attachments: hook.png (26.1k)