You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kurtis Williams <kw...@mshare.net> on 2005/01/06 00:25:02 UTC

Detecting if a component has a body

Does anybody know of a way to detect if a component has a body or not?
I need to render using a writer.beginEmpty if there is no body and
writer.begin if there is one.  This is necessary because in VoiceXML,
certain tags will be ignored if they look like: <var name="myvar"></var>
when they should look like: <var name="myvar" />



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


How do I put my own monitor into a request cycle?

Posted by kranga <kr...@k2d2.org>.
The only opportunity seems to be in the construction of a request cycle. How
can I add my own monitor?



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


Re: Component initialization

Posted by Bryan Lewis <br...@maine.rr.com>.
I don't believe components are pooled.  A component's instance variable
would not be retained from one use to the next.  (Nor would a non-persistent
property be stored in the session, of course.)  It's an easy thing to verify
though.



----- Original Message ----- 
From: "kranga" <kr...@k2d2.org>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, January 05, 2005 10:23 PM
Subject: Component initialization


> Is there a way to ensure that a component is properly initialized()
(similar
> to initialize() method for pages?). Are components pooled the same way as
> pages? I have an arrayList in a component that should be cleared before
use
> in a request cycle? How do I guarantee that?
>
> Thanks
>
>
> ---------------------------------------------------------------------
> 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


Component initialization

Posted by kranga <kr...@k2d2.org>.
Is there a way to ensure that a component is properly initialized() (similar
to initialize() method for pages?). Are components pooled the same way as
pages? I have an arrayList in a component that should be cleared before use
in a request cycle? How do I guarantee that?

Thanks


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


getForm().getComponents() always returns empty map in rewind phase

Posted by kranga <kr...@k2d2.org>.
I'm calling getForm(cycle).getComponents() within the rewind phase in a
component contained in the form. The returned map seems to be empty always.
Is there something I'm doing wrong?



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


Help with form-component interactions

Posted by kranga <kr...@k2d2.org>.
This is what I am trying to do:

Component A and B are Form components with A defined before B. When the form
submits, I need A to get the value of B to do some work. All works fine if I
define A after B. However, I need to be able to define A before B. Therefore
in the renderComponent() method, I am doing -

    getField() returns IFormComponent and is a parameter that gets set in
the page.

        if (getForm(pCycle).isRewinding())
        {
            String fieldName = (getForm(pCycle).getElementId(getField()));
            String fieldValue =
pCycle.getRequestContext().getParameter(fieldName);

            int i = Integer.parseInt(fieldValue);
            // Do stuff with i
            return;
        }

When I try the above, I get a Stale Link error. My questions are:
1) What's wrong above? why can't I access the other component's value
directly from the request?
2) Can this be done any other way?
3) If I have the target component B in a loop, how do I set the field
parameter of component A to a specific component B?

Thanks


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


Re: Detecting if a component has a body

Posted by Howard Lewis Ship <hl...@gmail.com>.
I believe AbstractComponent has a getBody() method.


On Wed, 5 Jan 2005 16:25:02 -0700, Kurtis Williams <kw...@mshare.net> wrote:
> Does anybody know of a way to detect if a component has a body or not?
> I need to render using a writer.beginEmpty if there is no body and
> writer.begin if there is one.  This is necessary because in VoiceXML,
> certain tags will be ignored if they look like: <var name="myvar"></var>
> when they should look like: <var name="myvar" />
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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