You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by o1550762 <o1...@rtrtr.com> on 2012/10/20 21:12:49 UTC

Mixing parameters from component and page

I have one component named PartofAddition.java and in it I have the following

public class PartOfAddition{
@Property
private int number;

@Property
private int picture;

public int getNumber()
{
 return number;
}

public int getPicture()
{
 return picture;
}
}
//PartOfAddition.tml

<div class="section">
<div class="post_number><label>${message:number}: </label><input
t:type="int" t:id="number" t:validate="required" size="4"></input></div>

<div class="post_number><label>${message:picture}: </label><input
t:type="TextField" t:id="picture" t:validate="required"
size="4"></input></div>


and page in which I try to call this component and along with some of the
fields declared in it and in PartOfAddition file, to compute some method.

public class ComputeAddition.java

@InjectComponent
private PartOfAddition partOfAddition;

@Parameter
private int number2;

public int computeIt(){
*//return addition of the two numbers, one from this page, and another from
the component PartOfAddition*
}


I have no idea how to implement this bolded. Any help is greatly
appreciated. Thanks in advance.
}



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Mixing-parameters-from-component-and-page-tp5717094.html
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: Mixing parameters from component and page

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
In Tapestry, components and pages are supposed to be a black box, so doing  
something that involves a field from one page and a field from one  
component is bad practice. I would put the calculation inside the  
component.

On Sat, 20 Oct 2012 16:12:49 -0300, o1550762 <o1...@rtrtr.com> wrote:

> I have one component named PartofAddition.java and in it I have the  
> following
>
> public class PartOfAddition{
> @Property
> private int number;
>
> @Property
> private int picture;
>
> public int getNumber()
> {
>  return number;
> }
>
> public int getPicture()
> {
>  return picture;
> }
> }
> //PartOfAddition.tml
>
> <div class="section">
> <div class="post_number><label>${message:number}: </label><input
> t:type="int" t:id="number" t:validate="required" size="4"></input></div>
>
> <div class="post_number><label>${message:picture}: </label><input
> t:type="TextField" t:id="picture" t:validate="required"
> size="4"></input></div>
>
>
> and page in which I try to call this component and along with some of the
> fields declared in it and in PartOfAddition file, to compute some method.
>
> public class ComputeAddition.java
>
> @InjectComponent
> private PartOfAddition partOfAddition;
>
> @Parameter
> private int number2;
>
> public int computeIt(){
> *//return addition of the two numbers, one from this page, and another  
> from
> the component PartOfAddition*
> }
>
>
> I have no idea how to implement this bolded. Any help is greatly
> appreciated. Thanks in advance.
> }
>
>
>
> --
> View this message in context:  
> http://tapestry.1045711.n5.nabble.com/Mixing-parameters-from-component-and-page-tp5717094.html
> 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
>


-- 
Thiago H. de Paula Figueiredo

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