留言板

Creating/Modifying taglib in ext environment

David F,修改在17 年前。

Creating/Modifying taglib in ext environment

New Member 帖子: 14 加入日期: 06-12-15 最近的帖子
Can someone tell me if there's a way to extend or modify Liferay taglibs in the extension environment? I looked in the documentation, but couldn't find anything. Any help would be appreciated, thanks!
javier de Ros,修改在17 年前。

RE: Creating/Modifying taglib in ext environment

New Member 帖子: 2 加入日期: 07-2-22 最近的帖子
I'm the same problem. How can I make externals tagbils from the theme?emoticon
Shane W,修改在16 年前。

RE: Creating/Modifying taglib in ext environment

New Member 帖子: 16 加入日期: 06-10-19 最近的帖子
Here’s how I created custom taglibs in the ext environment. I was trying to create my own search iterator, which I use as an example below.

You’ll see in step 3 that I sorta hacked some stuff because I couldn’t get the linking to work. I couldn’t get files in ext-ejb to see java files in portal/util-taglib. Hopefully someone who knows more about this can solve this problem.

1. Create the new page.jsp:
a. Create a taglib folder in ext-web/docroot/html/
b. Then add other files/folders as needed
c. Ex: ext-web/docroot/html/taglib/ui/my_search_iterator/page.jsp
i. page.jsp is just a slightly modified version of the regular search_iterator/page.jsp

2. Create the new *.tld file
a. Created the following folder: ext-web/WEB-INF/tld
b. Add your modified *.tld
c. Ex: liferay-ui-ext.tld
d. Mine looked like:
<taglib>
	<tlibversion>1.0</tlibversion>
	<jspversion>1.1</jspversion>
	<shortname>liferay-ui-ext</shortname>
	<uri>http://liferay.com/tld/ui-ext</uri>
	<tag>
		<name>my-search-iterator</name>
		<tagclass>com.ext.taglib.ui.MySearchIteratorTag</tagclass>
		<bodycontent>JSP</bodycontent>
		<attribute>
			<name>page</name>
			<required>false</required>
			<rtexprvalue>true</rtexprvalue>
		</attribute>
		<attribute>
			<name>searchContainer</name>
			<required>true</required>
			<rtexprvalue>true</rtexprvalue>
		</attribute>
	</tag>
</taglib>


3. Create the corresponding java files
a. I hacked this because I couldn’t figure out how to get my files to recognize files that already existed in util-taglib. Someone who knows the build files want to help with this?
b. Create: ext-ejb/src/com/ext/taglib
c. Add the appropriate files
d. I added MySearchIteratorTag.java & just changed the _PAGE to point to the page.jsp specified above.
e. However, to get things to compile I also copied SearchFormTag.java from util-taglib/src/com/liferay/taglib/ui & the directory & all files in util-taglib/src/com/liferay/taglib/util
i. I just changed the package for these files and the include paths to specify the right version.
ii. There’s got to be a way to reference the originals, I just don’t know it.
iii. I commend out the VelocityTaglib part of ThemeUtil.java because VelocityTaglib included a ton of dependencies I didn’t want to copy over and I’m not using velocity themes.

4. Update web.xml
a. Edit ext-web/WEB-INF web.xml to include references to your new taglib.
b. Eg:
<taglib>
	<taglib-uri>http://liferay.com/tld/ui-ext</taglib-uri>
	<taglib-location>/WEB-INF/tld/liferay-ui-ext.tld</taglib-location>
</taglib>



5. Edit init-ext.jsp to include the taglib
a. Ext-web/temp/html/common/init-ext.jsp
b. I added the line:
i.
&lt;%@ taglib uri="http://liferay.com/tld/ui-ext" prefix="liferay-ui-ext" %&gt;


That did the trick for me. If anyone can tell me how to clean up the linking in step 3 so I don’t need to include a bunch of redundant files that would be great.

Hope that helps
thumbnail
claudia wagner,修改在15 年前。

RE: Creating/Modifying taglib in ext environment

New Member 帖子: 5 加入日期: 08-4-13 最近的帖子
It is not necessary to copy the complete ui and util folder from util-taglib/src/com/liferay/taglib to the ext folder.
I extended the discussion taglib in the following way and it works:

1. Create a taglib/ui folder in ext-web/docroot/html/
2. Create the new page.jsp or copy page.jsp from the taglib you want to modify (for example from portal-web/docroot/html/taglib/ui/discussion)
3. ext-web/docroot/html/taglib/ui/discussion-ext/page.jsp
4. page.jsp is just a slightly modified version of the regular portal-web/docroot/html/taglib/ui/discussion/page.jsp
5. Create the new *.tld file
6. Created the following folder: ext-web/WEB-INF/tld
7. Add your modified *.tld
8. example liferay-ui-ext.tld could look like this:

<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.1</jsp-version>
<short-name>liferay-ui-ext</short-name>
<uri>http://liferay.com/tld/ui-ext</uri>
<tag>
<name>discussion-ext</name>
<tag-class>com.ext.taglib.ui.DiscussionTagEXT</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>page</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>formName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>formAction</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>className</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>classPK</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>userId</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>subject</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>redirect</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

9. The short-name and the uri on the top of the file, define the name and the uri of the taglib!!!!
10. the name of the tag is defined for each tag member of the taglib.
11. for example liferay-ui-ext:discussion-ext references the tag tag discussion-ext from the taglib liferay-ui-ext
12. copy the java files, which belong to the taglib, from util-taglib/src/com/liferay/taglib/ui/ (example DiscussionTag.java)
to ext-impl/src/com/ext/taglib/ui and rename the class so, that the classname corresponds with the
<tag-class>com.ext.taglib.ui.DiscussionTagEXT</tag-class> from the tld file specified before.
13.Update web.xml in the ext-web/docroot/WEB_INF folder so that the server knows where the taglib is located

<web-app>
<taglib>
<taglib-uri>http://liferay.com/tld/ui-ext</taglib-uri>
<taglib-location>/WEB-INF/tld/liferay-ui-ext.tld</taglib-location>
</taglib>
</web-app>

14. Edit init-ext.jsp (in portal-web/docroot/html/portlet) to include the taglib.
<%@ taglib uri="http://liferay.com/tld/ui-ext" prefix="liferay-ui-ext" %>
There is also a init-ext.jsp in portal-web/docroot/html/taglib, but this is not the right one.

Hope this helps!
thumbnail
Tejas H Kanani,修改在15 年前。

RE: Creating/Modifying taglib in ext environment

New Member 帖子: 19 加入日期: 08-3-11 最近的帖子
hi all,

I want to modify themeUtil.java file which is in portal (portal\util-taglib\src\com\liferay\taglib\util) and i want to put that file in ext
then what folder structure should i follow to create it in ext.

and do i need to change the tld file ???

thanks,
thumbnail
Srikanth Reddy Sanivarapu,修改在15 年前。

RE: Creating/Modifying taglib in ext environment

Regular Member 帖子: 203 加入日期: 08-11-15 最近的帖子
Tejas H Kanani:
hi all,

I want to modify themeUtil.java file which is in portal (portal\util-taglib\src\com\liferay\taglib\util) and i want to put that file in ext
then what folder structure should i follow to create it in ext.

and do i need to change the tld file ???

thanks,


Hi Tejas ,

Did u get the solution for this.

If u got the solution plz reply me with solution for this..?

Thanks & Regards,
Srikanth Reddy.S
thumbnail
Tejas H Kanani,修改在15 年前。

RE: Creating/Modifying taglib in ext environment

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
Tejas H Kanani:
Hi Tejas ,

Did u get the solution for this.

If u got the solution plz reply me with solution for this..?

Thanks & Regards,
Srikanth Reddy.S


so here is the solution ...

you'll need to put that modified ThemeUtil.java in ext-impl/src/com/liferay/taglib/util/
so your complete path for ThemeUtil.java file would be /ext-impl/src/com/liferay/taglib/util/ThemeUtil.java

Then just deploy ext ....
Thats it ...
Joyita Sikder,修改在12 年前。

RE: Creating/Modifying taglib in ext environment

New Member 发布: 1 加入日期: 10-12-2 最近的帖子
Hi All,

I created a custom taglib in the ext-plugin environment. I am able to use the taglib in the hooks jsp.
If I use the custom taglib in portlet-plugin I get the following error in my tomcat console "No tag "customTab" defined in tag library imported with prefix "liferay-ui".

Please let me know if I am missing out something.

Thanks in advance !!

Thanks,
Joyita