论坛

主页 » Liferay Portal » English » Liferay Legacy

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
David F
Creating/Modifying taglib in ext environment
2007年1月25日 上午11:04
答复

David F

等级: New Member

帖子: 14

加入日期: 2006年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
RE: Creating/Modifying taglib in ext environment
2007年2月22日 上午7:51
答复

javier de Ros

等级: New Member

帖子: 2

加入日期: 2007年2月22日

最近的帖子

I'm the same problem. How can I make externals tagbils from the theme?emoticon
Shane W
RE: Creating/Modifying taglib in ext environment
2007年4月12日 下午1:26
答复

Shane W

等级: New Member

帖子: 16

加入日期: 2006年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:
 1<taglib>
 2    <tlibversion>1.0</tlibversion>
 3    <jspversion>1.1</jspversion>
 4    <shortname>liferay-ui-ext</shortname>
 5    <uri>http://liferay.com/tld/ui-ext</uri>
 6    <tag>
 7        <name>my-search-iterator</name>
 8        <tagclass>com.ext.taglib.ui.MySearchIteratorTag</tagclass>
 9        <bodycontent>JSP</bodycontent>
10        <attribute>
11            <name>page</name>
12            <required>false</required>
13            <rtexprvalue>true</rtexprvalue>
14        </attribute>
15        <attribute>
16            <name>searchContainer</name>
17            <required>true</required>
18            <rtexprvalue>true</rtexprvalue>
19        </attribute>
20    </tag>
21</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:
1<taglib>
2    <taglib-uri>http://liferay.com/tld/ui-ext</taglib-uri>
3    <taglib-location>/WEB-INF/tld/liferay-ui-ext.tld</taglib-location>
4</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.
1<%@ taglib uri="http://liferay.com/tld/ui-ext" prefix="liferay-ui-ext" %>


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
claudia wagner
RE: Creating/Modifying taglib in ext environment
2008年4月17日 上午2:03
答复

claudia wagner

等级: New Member

帖子: 6

加入日期: 2008年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!
Tejas H Kanani
RE: Creating/Modifying taglib in ext environment
2008年11月10日 上午1:51
答复

Tejas H Kanani

等级: New Member

帖子: 20

加入日期: 2008年3月10日

最近的帖子

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,
Srikanth Reddy Sanivarapu
RE: Creating/Modifying taglib in ext environment
2009年2月9日 下午9:44
答复

Srikanth Reddy Sanivarapu

等级: Regular Member

帖子: 193

加入日期: 2008年11月14日

最近的帖子

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
Tejas Kanani
RE: Creating/Modifying taglib in ext environment
2009年2月15日 上午2:41
答复

Tejas Kanani

等级: Liferay Master

帖子: 652

加入日期: 2009年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
RE: Creating/Modifying taglib in ext environment
2011年6月15日 下午3:40
答复

Joyita Sikder

等级: New Member

帖子: 1

加入日期: 2010年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