You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jake123 <ja...@gmail.com> on 2006/10/09 22:19:25 UTC

How to pass parameters between Page and component

Hi, I have a (hopefully) easy question. I have My index.page where I use some
components. One of them needs a parameter articleId passed to it from my
index.java file where I have a getArticleId().
I thaugh that I declared a parameter in the .page file and then use the same
parameter in my binding tag in the component like this:

       <parameter name="articleId" required="yes"/>

        <component id="articleComp" type="ArticleComp">
		<binding name="value" value="articleId"/>		
	</component>

but I get an error when I do this.

Unexpected element parameter within page-specification.

So my question is: How do I pass my articleId from my index.java to my
custom component?

Thanks
Jacob  
-- 
View this message in context: http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf2412533.html#a6724770
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: How to pass parameters between Page and component

Posted by jake123 <ja...@gmail.com>.
thank you Dennis for your answer, it works perfectly fine :-)
Cheers,
Jacob

-- 
View this message in context: http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf2412533.html#a6737930
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: How to pass parameters between Page and component

Posted by Dennis Sinelnikov <de...@augustschell.com>.
Jacob,

Try this...

Index.page:
<component id="articleComp" type="ArticleComp">
	<binding name="articleId" value="currentArticleId"/>
</component>

ArticleComp.jwc:
<parameter name="articleId" required="yes"/>

Index.java should contain getCurrentArticleId();

Regards,
Dennis

jake123 wrote:
> Hi, I have a (hopefully) easy question. I have My index.page where I use some
> components. One of them needs a parameter articleId passed to it from my
> index.java file where I have a getArticleId().
> I thaugh that I declared a parameter in the .page file and then use the same
> parameter in my binding tag in the component like this:
> 
>        <parameter name="articleId" required="yes"/>
> 
>         <component id="articleComp" type="ArticleComp">
> 		<binding name="value" value="articleId"/>		
> 	</component>
> 
> but I get an error when I do this.
> 
> Unexpected element parameter within page-specification.
> 
> So my question is: How do I pass my articleId from my index.java to my
> custom component?
> 
> Thanks
> Jacob  


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


RE: How to pass parameters between Page and component

Posted by jake123 <ja...@gmail.com>.
Thank you for your answer, I will try this solution too.
Cheers,
Jacob
-- 
View this message in context: http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf2412533.html#a6737950
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


RE: How to pass parameters between Page and component

Posted by Firas Adiler <ta...@idigna.com>.
Hi,

It should be more like:
      <component id="articleComp" type="ArticleComp">
		<binding name="articleId" value="ognl:articleId"/>	
	</component>

In your ArticleComp you access the 'articleId' parameter like this:
IBinding iBinding = getBinding("articleId");
String articleId = (String) iBinding.getObject("articleId");

Regards,

</Firas>

-----Original Message-----
From: jake123 [mailto:jacob.bergoo@gmail.com] 
Sent: Monday, October 09, 2006 10:19 PM
To: users@tapestry.apache.org
Subject: How to pass parameters between Page and component


Hi, I have a (hopefully) easy question. I have My index.page where I use
some components. One of them needs a parameter articleId passed to it from
my index.java file where I have a getArticleId().
I thaugh that I declared a parameter in the .page file and then use the same
parameter in my binding tag in the component like this:

       <parameter name="articleId" required="yes"/>

        <component id="articleComp" type="ArticleComp">
		<binding name="value" value="articleId"/>		
	</component>

but I get an error when I do this.

Unexpected element parameter within page-specification.

So my question is: How do I pass my articleId from my index.java to my
custom component?

Thanks
Jacob
--
View this message in context:
http://www.nabble.com/How-to-pass-parameters-between-Page-and-component-tf24
12533.html#a6724770
Sent from the Tapestry - User mailing list archive at Nabble.com.



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