You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2005/08/20 17:34:50 UTC

How do I work round not putting components in a conditional?

I am trying to do a list of items in a list, with a condition that means that 
in certain circumstances a @Directlink would not get thrown.  This gives a 
parse error exception because it is not allowed to have dynamic components 
which are not called.  What is the standard way of working around such an 
issue?

The following (excuse the word wrap) is my attempt at this which is not 
working

	<ul>
		<span jwcid="mainmenu@Foreach" source="ognl:appMenuNames" 
value="ognl:eachAppName">
			<li jwcid="@If" condition="ognl:eachAppName == thisAppName" 
class="selected">
				<a href"#">	<span jwcid="@Insert" value="ognl:appTitle >App 
Title</span></a></li>
			<li jwcid="@Else" condition="ognl:eachAppName == thisAppName">
				<a jwcid="@DirectLink" listener="listener:selectApp" 
parameters="ognl:eachAppName">
					<span jwcid="@Insert" value="ognl:appTitle">App Title</span>
				</a>
			</li>
		</span>
	</ul>




-- 
Alan Chandler
http://www.chandlerfamily.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: How do I work round not putting components in a conditional?

Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Saturday 20 Aug 2005 16:52, Filip S. Adamsen wrote:
> Hi Alan,
>
> You should use the "disabled" parameter of @DirectLink component instead
> of a @Conditional:

Fantastic - thank you.  I had been going of on all sorts of different 
directions, none of which are as straightforward as this.
-- 
Alan Chandler
http://www.chandlerfamily.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: How do I work round not putting components in a conditional?

Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
Hi Alan,

You should use the "disabled" parameter of @DirectLink component instead 
of a @Conditional:

<ul>
<span jwcid="mainmenu@Foreach"
       source="ognl:appMenuNames"
       value="ognl:eachAppName"
 >
   <li jwcid="@Any"
       class="ognl:eachAppName == thisAppName ? 'selected' : ''">
     <a href"#"
        jwcid="@DirectLink"
        listener:"listener:selectApp"
        disabled="ognl:eachAppName == thisAppName"
     >
       <span jwcid="@Insert" value="ognl:appTitle">
         App Title
       </span>
     </a>
   </li>
</span>
</ul>

Hope this helps.

-Filip

Alan Chandler wrote:
> I am trying to do a list of items in a list, with a condition that means that 
> in certain circumstances a @Directlink would not get thrown.  This gives a 
> parse error exception because it is not allowed to have dynamic components 
> which are not called.  What is the standard way of working around such an 
> issue?
> 
> The following (excuse the word wrap) is my attempt at this which is not 
> working
> 
> 	<ul>
> 		<span jwcid="mainmenu@Foreach" source="ognl:appMenuNames" 
> value="ognl:eachAppName">
> 			<li jwcid="@If" condition="ognl:eachAppName == thisAppName" 
> class="selected">
> 				<a href"#">	<span jwcid="@Insert" value="ognl:appTitle >App 
> Title</span></a></li>
> 			<li jwcid="@Else" condition="ognl:eachAppName == thisAppName">
> 				<a jwcid="@DirectLink" listener="listener:selectApp" 
> parameters="ognl:eachAppName">
> 					<span jwcid="@Insert" value="ognl:appTitle">App Title</span>
> 				</a>
> 			</li>
> 		</span>
> 	</ul>
> 
> 
> 
>