You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Darío Vasconcelos <da...@gmail.com> on 2005/10/06 03:12:08 UTC
@Script: Exception when calling a method with parameters
Hi All,
I'm building a Menu component based on the TigraMenu
(http://www.softcomplex.com/products/tigra_menu/) but I'm having a
hard time figuring how to create all the links for it.
Tigra Menu has a very cool MenuBuilder that creates a file called
menu_items.js, which specifies all the nodes of the menu and their
URLs in a special, customized format. This forces me to generate the
links inside this javascript file, but so far I've only found one
awkward method to create them:
I have a createPageLink(String page) method that returns a well-formed
Tapestry URL, that is called from my html:
<span jwcid="@Script"
page1="ognl:createPageLink('page1')"
page2="ognl:createPageLink('page2')" />
And in my .script file, I receive these parameters and just paste the
links inside the menu structure.
So far, so good. The problem is: this menu should have around 50
nodes, and it seems to me this is not a very clean solution if I have
to pass 50 parameters to the .script file. Another problem I have is
that half these links are @DirectLinks, not PageLinks (which would be
easy to hardcode anyway), so I **really** must let Tapestry figure the
URLs.
I've tried many many solutions, including
<set key="linkPage1" expression="createPageLink['Page1]"/>
inside the .script (Kent Tong suggested this approach in an old post -
http://article.gmane.org/gmane.comp.java.tapestry.user/19089 ) but
Tapestry complains with the Exception
source is null for getProperty(null, "Page1")
so it seems to me that the string "Page1" also has to be defined
inside the .script file... I've also tried changing the square
brackets to parentheses, preceding the expression with "ognl:",
calling ${createPageLink['Page1']} directly inside the <body> of the
script, and several other things, but with no luck.
I've read some of the documentation in the OGNL site, but every time I
define a variable with the <let> tag, either it just pastes the
function call (without actually calling it) or complains about the
Page1 property.
Right now I've spent more time trying to figure this than if I'd just
created the 50 parameters, but it seems to me that there must exist a
better, more TP'ed way to solve it...
Ideas? Please?
Regards,
Darío
--
I have enough money to last me the rest of my life, unless I buy something.
Jackie Mason
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: @Script: Exception when calling a method with parameters
Posted by Darío Vasconcelos <da...@gmail.com>.
forgot to mention, I'm using TP 3.0.3, if it makes any difference...
On 10/5/05, Darío Vasconcelos <da...@gmail.com> wrote:
> Hi All,
>
> I'm building a Menu component based on the TigraMenu
> (http://www.softcomplex.com/products/tigra_menu/) but I'm having a
> hard time figuring how to create all the links for it.
>
> Tigra Menu has a very cool MenuBuilder that creates a file called
> menu_items.js, which specifies all the nodes of the menu and their
> URLs in a special, customized format. This forces me to generate the
> links inside this javascript file, but so far I've only found one
> awkward method to create them:
>
> I have a createPageLink(String page) method that returns a well-formed
> Tapestry URL, that is called from my html:
>
> <span jwcid="@Script"
> page1="ognl:createPageLink('page1')"
> page2="ognl:createPageLink('page2')" />
>
> And in my .script file, I receive these parameters and just paste the
> links inside the menu structure.
>
> So far, so good. The problem is: this menu should have around 50
> nodes, and it seems to me this is not a very clean solution if I have
> to pass 50 parameters to the .script file. Another problem I have is
> that half these links are @DirectLinks, not PageLinks (which would be
> easy to hardcode anyway), so I **really** must let Tapestry figure the
> URLs.
>
> I've tried many many solutions, including
>
> <set key="linkPage1" expression="createPageLink['Page1]"/>
>
> inside the .script (Kent Tong suggested this approach in an old post -
> http://article.gmane.org/gmane.comp.java.tapestry.user/19089 ) but
> Tapestry complains with the Exception
>
> source is null for getProperty(null, "Page1")
>
> so it seems to me that the string "Page1" also has to be defined
> inside the .script file... I've also tried changing the square
> brackets to parentheses, preceding the expression with "ognl:",
> calling ${createPageLink['Page1']} directly inside the <body> of the
> script, and several other things, but with no luck.
>
> I've read some of the documentation in the OGNL site, but every time I
> define a variable with the <let> tag, either it just pastes the
> function call (without actually calling it) or complains about the
> Page1 property.
>
> Right now I've spent more time trying to figure this than if I'd just
> created the 50 parameters, but it seems to me that there must exist a
> better, more TP'ed way to solve it...
>
> Ideas? Please?
>
> Regards,
>
> Darío
>
>
>
> --
> I have enough money to last me the rest of my life, unless I buy something.
> Jackie Mason
>
--
I have enough money to last me the rest of my life, unless I buy something.
Jackie Mason
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org