cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject [c3] Implementing presentation logic in c3
Date Thu, 27 Oct 2011 22:39:41 GMT
Hi all,

what is the recommended way to implement presentation logic in c3? JX
was our former choice but I could not find it in c3. 

What should we use to implement simple presentation logic like we did
with jx? What are people using? Or do I need to migrate jx?

I tried to use the "string-template" component but I am running into a
problem when using $if(boolean)$.

I am ATM integrating Apache Shiro, a security framework that performs
authentication, authorization, cryptography, and session management,
into c3 and want to use something in the spirit of their taglibs 
    Please <a href="login.jsp">login</a>.

So what I did is I wrote a 
ShiroInterpreter implements LanguageInterpreter that can extract this info. 
However the interface LanguageInterpreter defines the return type to String.

<map:transform type="string-template">
  <map:parameter name="isUser" value="{shiro:authenticated}"/>

will fail then interpreting 
  <a href="/logout">/logout</a>
  <a href="/login">/login</a>

Caused by: org.stringtemplate.v4.compiler.STException: null
	at org.stringtemplate.v4.compiler.Compiler.reportMessageAndThrowSTException(

If I use only $isUser$ I get the correct value. Reading "Conditional subtemplates" [1] 
"You may only test whether an attribute is present or absent, preserving separation of model

and view. The only exception is that if an attribute value is a Boolean object, it will test
it for true/false."

So for me the exception either mean we do not support $if(condition)$ or that the compiler
do not likes that $isUser$ is a 
String and not a boolean.

TIA for any feedback!


Thorsten Scherler <>
codeBusters S.L. - web based systems
<consulting, training and solutions>

View raw message