You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by webtekie <we...@gmail.com> on 2005/04/13 16:33:42 UTC

'Tapestry in Action' example question

In the book there is an example on use of html forms and combo boxes.
One piece of code I don't quite understand:

public void selectToppings(IRequestCycle cycle)
{
         String toppings = getToppingsList();
         ToppingsResult page =
         (ToppingsResult) cycle.getPage("ToppingsResult");
         page.setToppings(toppings);
         cycle.activate(page);
}

What is the purpose of ToppingsResult class, what exectly does it cast?

thanks,
webtekie

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


Re: 'Tapestry in Action' example question

Posted by webtekie <we...@gmail.com>.
Yes, thanks I got it. This pdf 
http://www.ociweb.com/javasig/knowledgebase/2004-12/TapestryPresentation.pdfexplains
everything quite nicely.

On 4/13/05, Jamie <ja...@dang.com> wrote:
> 
> It's a tapestry page, which is not a simple bean, but it uses bean-style
> properties. If you're following standard procedure, these properties
> will be declared "abstract" in the java file and also declared in the
> page specification:
> 
> <property-specification name="foo" type="java.lang.String"/>
> 
> ----
> 
> public abstract String getFoo();
> public abstract void setFoo(String foo);
> 
> Jamie
> 
> webtekie wrote:
> 
> >So the casting class is just sort of Bean where I have all my getters and
> >setters for variables (according to
> >http://wiki.apache.org/jakarta-tapestry/MoreFrequentlyAskedQuestions that
> >Shing referenced)?
> >
> >On 4/13/05, Jamie <ja...@dang.com> wrote:
> >
> >
> >>It's another page!
> >>
> >>The code says:
> >>
> >>get the page called "ToppingsResult";
> >>set the property "toppings" to toppings;
> >>go to the page.
> >>
> >>
> >>webtekie wrote:
> >>
> >>
> >>
> >>>In the book there is an example on use of html forms and combo boxes.
> >>>One piece of code I don't quite understand:
> >>>
> >>>public void selectToppings(IRequestCycle cycle)
> >>>{
> >>>String toppings = getToppingsList();
> >>>ToppingsResult page =
> >>>(ToppingsResult) cycle.getPage("ToppingsResult");
> >>>page.setToppings(toppings);
> >>>cycle.activate(page);
> >>>}
> >>>
> >>>What is the purpose of ToppingsResult class, what exectly does it cast?
> >>>
> >>>thanks,
> >>>webtekie
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: 'Tapestry in Action' example question

Posted by Jamie <ja...@dang.com>.
It's a tapestry page, which is not a simple bean, but it uses bean-style 
properties. If you're following standard procedure, these properties 
will be declared "abstract" in the java file and also declared in the 
page specification:

<property-specification name="foo" type="java.lang.String"/>

----

public abstract String getFoo();
public abstract void setFoo(String foo);

Jamie

webtekie wrote:

>So the casting class is just sort of Bean where I have all my getters and 
>setters for variables (according to 
>http://wiki.apache.org/jakarta-tapestry/MoreFrequentlyAskedQuestions that 
>Shing referenced)?
>
>On 4/13/05, Jamie <ja...@dang.com> wrote:
>  
>
>>It's another page!
>>
>>The code says:
>>
>>get the page called "ToppingsResult";
>>set the property "toppings" to toppings;
>>go to the page.
>>
>>
>>webtekie wrote:
>>
>>    
>>
>>>In the book there is an example on use of html forms and combo boxes.
>>>One piece of code I don't quite understand:
>>>
>>>public void selectToppings(IRequestCycle cycle)
>>>{
>>>String toppings = getToppingsList();
>>>ToppingsResult page =
>>>(ToppingsResult) cycle.getPage("ToppingsResult");
>>>page.setToppings(toppings);
>>>cycle.activate(page);
>>>}
>>>
>>>What is the purpose of ToppingsResult class, what exectly does it cast?
>>>
>>>thanks,
>>>webtekie
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>    
>>
>
>  
>

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


Re: 'Tapestry in Action' example question

Posted by webtekie <we...@gmail.com>.
So the casting class is just sort of Bean where I have all my getters and 
setters for variables (according to 
http://wiki.apache.org/jakarta-tapestry/MoreFrequentlyAskedQuestions that 
Shing referenced)?

On 4/13/05, Jamie <ja...@dang.com> wrote:
> 
> It's another page!
> 
> The code says:
> 
> get the page called "ToppingsResult";
> set the property "toppings" to toppings;
> go to the page.
> 
> 
> webtekie wrote:
> 
> >In the book there is an example on use of html forms and combo boxes.
> >One piece of code I don't quite understand:
> >
> >public void selectToppings(IRequestCycle cycle)
> >{
> > String toppings = getToppingsList();
> > ToppingsResult page =
> > (ToppingsResult) cycle.getPage("ToppingsResult");
> > page.setToppings(toppings);
> > cycle.activate(page);
> >}
> >
> >What is the purpose of ToppingsResult class, what exectly does it cast?
> >
> >thanks,
> >webtekie
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

Re: 'Tapestry in Action' example question

Posted by Jamie <ja...@dang.com>.
It's another page!

The code says:

get the page called "ToppingsResult";
set the property "toppings" to toppings;
go to the page.



webtekie wrote:

>In the book there is an example on use of html forms and combo boxes.
>One piece of code I don't quite understand:
>
>public void selectToppings(IRequestCycle cycle)
>{
>         String toppings = getToppingsList();
>         ToppingsResult page =
>         (ToppingsResult) cycle.getPage("ToppingsResult");
>         page.setToppings(toppings);
>         cycle.activate(page);
>}
>
>What is the purpose of ToppingsResult class, what exectly does it cast?
>
>thanks,
>webtekie
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>  
>

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


Re: 'Tapestry in Action' example question

Posted by Andy Pahne <a....@skaffen.de>.

You are requesting the next page from the request cycle. That is the
ToppingsResult(Page). Because cycle.getPage("...") returns IPage, you
would not be able to execute setToppings(...). By casting to the
concrete implementation of the ToppingsResult page, you can.





webtekie schrieb:
> In the book there is an example on use of html forms and combo boxes.
> One piece of code I don't quite understand:
> 
> public void selectToppings(IRequestCycle cycle)
> {
>          String toppings = getToppingsList();
>          ToppingsResult page =
>          (ToppingsResult) cycle.getPage("ToppingsResult");
>          page.setToppings(toppings);
>          cycle.activate(page);
> }
> 
> What is the purpose of ToppingsResult class, what exectly does it cast?
> 
> thanks,
> webtekie
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

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