Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Camilla M.
Hook custom Taglib
February 2, 2011 6:20 AM
Answer

Camilla M.

Rank: New Member

Posts: 3

Join Date: October 9, 2010

Recent Posts

Hi there,

for my current portlet project I developed a custom "calendarType" taglib and I want it to be adapted by the liferay portal as well.

Does anybody know how to "hook" a taglib for the liferay portal source?

Greets
Camilla
Andrés Cerezo
RE: Hook custom Taglib
February 4, 2011 3:56 AM
Answer

Andrés Cerezo

Rank: Junior Member

Posts: 92

Join Date: November 11, 2010

Recent Posts

Hello, I've the same problem, Did you find the solution?

Cheers.
Patrick NERDEN
RE: Hook custom Taglib
June 7, 2012 9:23 AM
Answer

Patrick NERDEN

Rank: New Member

Posts: 10

Join Date: April 16, 2010

Recent Posts

Same question here : how can I add a custom taglib through a hook instead of an ext-plugin ?
Nicolas Forney
RE: Hook custom Taglib
October 26, 2012 6:23 AM
Answer

Nicolas Forney

Rank: Junior Member

Posts: 78

Join Date: May 23, 2011

Recent Posts

Hello,

Sorry for digging up old post, but I'm asking myself the same question and there is still no answer...

Any idea if it's possible to use hook to overwrite liferay taglibs ? Or isn't it only possible through an ext plugin?

Thx
Nicolas Forney
RE: Hook custom Taglib
October 26, 2012 6:47 AM
Answer

Nicolas Forney

Rank: Junior Member

Posts: 78

Join Date: May 23, 2011

Recent Posts

Well, finally it's pretty easy to hook taglibs.

Just create a hook plugin set the following line in the liferay-hook.xml :
1<hook>
2    <custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>      
3</hook>


Then, add the taglib files you want to override inside the custom_jsps folder of your project.
1docroot/META-INF/custom_jsps


Let say you want to override the liferay-ui:header, just copy the init.jsp file and the page.jsp located in the Liferay sources into :
1 portal-web/docroot/html/taglib/ui/header

and then, copy the files to your project in the following folder :
1docroot/META-INF/custom_jsps/html/taglib/ui/header
.

You can now deploy your hook !

I did this with Liferay 6.1
R. Code you need
RE: Hook custom Taglib
June 21, 2014 8:07 AM
Answer

R. Code you need

Rank: New Member

Posts: 4

Join Date: July 28, 2010

Recent Posts

I had a similar issue but I wanted to create my own custom taglib that I could use in my many different portlet projects and render the JSP's like liferay tags do it. Turns out it's not THAT difficult but does require you to split the Hook and Taglib itself into separate projects so that you could reference the taglib project via Maven during development time and keep Eclipse from complaining.

Here's a short tutorial on how I did it: http://www.codeyouneed.com/how-to-create-a-taglib-with-jsps-for-liferay