1

How to use Spring Security taglib on ZUL page ?

asked 2009-03-17 18:20:35 +0800

atxmaniek gravatar image atxmaniek
82 1 3

updated 2009-03-17 18:21:42 +0800

At first i have alreay read this - Developer reference The ZK User Interface Markup Language Processing Instructions The taglib Directive

But i cant edit /metainfo/tld/config.xml because its in zul.jar
So i tried:

<?taglib prefix="sec" uri="http://www.springframework.org/security/tags" ?>
- but not works, results with
org.zkoss.xel.XelException: Resource not found: http://www.springframework.org/security/tags

so i copied security.tld from spring security package to /WEB-INF/tld/security.tld
and tried:
<?taglib uri="/WEB-INF/tld/security.tld" prefix="sec"?>
no error

but when i try use:
<sec:authorize ifAllGranted="ROLE_ADMIN">
		<label value="${username }" />
		<label value="${userRole }" />
</sec:authorize>

it results with:
org.zkoss.lang.SystemException: org.xml.sax.SAXParseException: The prefix "sec" for element "sec:authorize" is not bound.


Can somebody help me pass through this ?

delete flag offensive retag edit

16 Replies

Sort by ยป oldest newest

answered 2009-03-23 06:09:25 +0800

PeterKuo gravatar image PeterKuo
481 2

zul.jar is simply a type of zip file.
Did you try to unzip it, modify the content, and zip it?

link publish delete flag offensive edit

answered 2009-05-04 22:45:23 +0800

bdrhoa gravatar image bdrhoa
90 2

I'm having the same problem. According to the docs

<?taglib uri="/WEB-INF/tld/security.tld" prefix="sec"?>

should work. But I get the "not bound" error too. So there seems to be a bug.

I did go ahead and edit the config.xml and recreate zul.jar and use

<?taglib uri='http://www.springframework.org/security/tags' prefix='sec' ?>

which still results in

org.zkoss.xel.XelException: Resource not found: http://www.springframework.org/security/tags

BTW - I also tried:

<%@ taglib uri='http://www.springframework.org/security/tags' prefix='sec' %>

and got this error:

The markup in the document preceding the root element must be well-formed.

Any ideas?

link publish delete flag offensive edit

answered 2009-05-13 02:00:45 +0800

bdrhoa gravatar image bdrhoa
90 2

Does anyone know how to make spring security tags work?

link publish delete flag offensive edit

answered 2009-05-14 01:50:55 +0800

PeterKuo gravatar image PeterKuo
481 2

I refined doc of taglib.

<%@ is the syntax of jsp, not ZK zul.

Hope this can help.

link publish delete flag offensive edit

answered 2009-05-14 17:52:16 +0800

bdrhoa gravatar image bdrhoa
90 2

Using zul within .jsp looks like a solution, however it it doesn't seem to work with ZK 3.6.1

link publish delete flag offensive edit

answered 2009-08-01 14:28:09 +0800

devrin gravatar image devrin
3

Has anyone been able to get the spring security taglibs working? I can't even get eclipse to recognize the taglibs. I have redefined the zul.jar file as PeterKuo has suggested.. but still nothing. Am I missing something in the taglib redefinition?

link publish delete flag offensive edit

answered 2009-08-05 03:22:13 +0800

PeterKuo gravatar image PeterKuo
481 2

Please follow the wiki
http://docs.zkoss.org/wiki/Developer_reference_The_ZK_User_Interface_Markup_Language_Processing_Instructions_The_taglib_Directive


If you want to load a TLD file from your Web application, you can specify the path as follows.

<?taglib uri="/WEB-INF/tld/my.tld" prefix="my"?>

link publish delete flag offensive edit

answered 2009-10-07 11:38:51 +0800

geet gravatar image geet
66

updated 2009-10-07 11:40:55 +0800

hi ,

Me too facing the same problem.... i have a custom tld to be acessed in zul page(taglib uri).i have placed the tld in web-inf/tld/web/abc.tld. but its not working Can anyone please sugest me..... wht's the reason????

thanks in advance.......................

Regards
geet

link publish delete flag offensive edit

answered 2009-10-08 00:40:01 +0800

PeterKuo gravatar image PeterKuo
481 2

If you place file as

WebContent/WEB-INF/tld/aaa.tld

and use taglib like following line

<?taglib uri="/WEB-INF/tld/a.tld" prefix="z"?>

you should be able to access it.

link publish delete flag offensive edit

answered 2009-10-09 11:37:41 +0800

geet gravatar image geet
66

updated 2009-10-26 01:28:13 +0800

hi PeterKuo,

If iam able to acess, then i would have not posted my problem.iam able to acess in jsp but not zul
Can u please go thru the code, and try to reslove,

this is my .tld file ,

<?xml version="1.0" encoding="ISO-8859-1" ?>





<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglib_1_1.dtd">


<taglib>
<!-- The version number of this tag library -->
<tlibversion>1.0</tlibversion>

<!-- The JSP specification version required to function -->
<jspversion>1.1</jspversion>

<!-- The short name of this tag library -->
<shortname>utility</shortname>

<!-- Public URI that uniquely identifies this version of the tag library -->
<uri>http://jakarta.apache.org/taglibs/utilitytags</uri>

<!-- General information about this tag library -->
<info>
A simple tag library for the examples
</info>
<!-- Hello tag -->
<tag>
<name>hello</name>
<tagclass>com.prof.HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<info>
Print Hello World
</info>


<attribute>
<name>Single</name>
</attribute>

</tag>
</taglib>

index.Zul file

<?taglib uri="/WEB-INF/tld/aaa.tld" prefix="g"?>
<?taglib uri="/WEB-INF/tld/web/core.dsp.tld" prefix="c" ?>
<zk>

<window>

<g:hello --------------------- this shld work, but its not :( , error - g:hello is not bound...


</window>
</zk>

Am i missing something????

Thnks in Advance ...

regards
geet

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-03-17 18:20:35 +0800

Seen: 4,349 times

Last updated: Oct 18 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More