Base on my Experiment the Alert JS will pop out. the begin render in my
component is executed.
But the design is not loaded by the JQuery.

I wonder y? need more further investigation!

My Code ---------------------------------------------------

public class Myblock {

    @Inject
    @Path("context:layout/scripts/jquery-1.3.2.min.js")
    private Asset someScript1;

    @Inject
    @Path("context:layout/scripts/pagination.js")
    private Asset someScript;

    @Inject
    @Path("context:layout/scripts/alert.js")
    private Asset someScript2;

    @Environmental
    private RenderSupport renderSupport;

    void beginRender() {
        renderSupport.addScriptLink(someScript1);
        renderSupport.addScriptLink(someScript);
        renderSupport.addScriptLink(someScript2);
    }

}


        <t:form>
            <t:actionlink t:id="button1"
t:zone="output">button1</t:actionlink>&nbsp;
            <t:actionlink t:id="button2"
t:zone="output">button2</t:actionlink>&nbsp;
        </t:form>

        <div>
            <t:zone t:id="output" t:update="show">
                <t:delegate to="prop:blockToRender" />
            </t:zone>
        </div>

        <t:block t:id="defaultBlock">
            Default value!
        </t:block>

        <t:block t:id="block1">            

        <t:Myblock>
        
        .......JQUERY.....

        </t:Myblock>

        </t:block>
        
        <t:block t:id="block2">            

        <t:Myblock>
        .......JQUERY.....

        </t:Myblock>

        </t:block>


public class Index
{
    @Inject
    private Block block1;

    @Inject
    private Block block2;

    @Inject
    private Block defaultBlock;

    private Block blockToRender;

    void beginRender(){
        if (blockToRender == null)
        {
            blockToRender = defaultBlock;
        }
    }

    public Block getBlockToRender() {
        return blockToRender;
    }

    public void setBlockToRender(Block blockToRender) {
        this.blockToRender = blockToRender;
    }

    Object onActionFrombutton1()
    {
        setBlockToRender(block1);
        return blockToRender;
    }

    Object onActionFrombutton2()
    {
        setBlockToRender(block2);
        return blockToRender;
    }
}


-----------------------------------------------------------------


alanearl wrote:
> 
> Thanks you for the response Sir Howard
> 
> Currently the other way to do it is to use Request Parameters.
> But i dont like the refresh thing.... maybe for now this will do the trick
> then in the future i will reveal the mystery of Block with javascript.
> 
> Thanks a lot, i will visit the link you gave...
> 
> Also if you make a Tapestry 5.1.0.5 Book with a lot of examples
> on it in every components it can benefit everyone Right!
> Heheheheh i'd like to buy one also.
> 
> 
> Howard Lewis Ship wrote:
>> 
>> I suspect you are not getting much of a response because you are
>> asking too much from us; try giving this document a look over:
>> 
>> http://www.catb.org/~esr/faqs/smart-questions.html
>> 
>> 
>> On Tue, Nov 24, 2009 at 12:49 AM, alanearl <alan-lua...@dash.com.ph>
>> wrote:
>>>
>>> Sorry @Environment is lacking
>>> But still no luck heheheh...
>>>
>>>
>>>
>>> alanearl wrote:
>>>>
>>>> Excuse Me Sir Howard,
>>>>
>>>> Could you help me with this? Im receiving error...
>>>>
>>>>
>>>> org.apache.tapestry5.internal.services.RenderQueueException
>>>> Render queue error in BeginRender[Index:myblock]:
>>>> org.apache.tapestry5.ioc.internal.util.TapestryException
>>>>
>>>> Template Class
>>>>         <t:actionlink t:id="Button1" t:zone="output">Click
>>>> Me1!</t:actionlink>&nbsp;
>>>>         <t:actionlink t:id="Button2" t:zone="output">Click
>>>> Me2!</t:actionlink>&nbsp;
>>>>
>>>>         <t:zone t:id="output" t:update="show">
>>>>             Hello
>>>>             <t:delegate to="prop:blockToRender" />
>>>>         </t:zone>
>>>>
>>>>         <t:Myblock>
>>>>
>>>>       <t:block t:id="block1">
>>>>       </t:block>
>>>>       <t:block t:id="block2">
>>>>       </t:block>
>>>>
>>>>         </t:Myblock>
>>>>
>>>> Page Class
>>>>
>>>> public class Index
>>>> {
>>>>     @InjectComponent
>>>>     private Zone output;
>>>>
>>>>     @Inject
>>>>     private Block block1;
>>>>
>>>>     @Inject
>>>>     private Block block2;
>>>>
>>>>     private Block blockToRender;
>>>>
>>>>     public Block getBlockToRender() {
>>>>         return blockToRender;
>>>>     }
>>>>
>>>>     public void setBlockToRender(Block blockToRender) {
>>>>         this.blockToRender = blockToRender;
>>>>     }
>>>>
>>>>     Object onActionFromButton1()
>>>>     {
>>>>         setBlockToRender(block1);
>>>>         return blockToRender;
>>>>     }
>>>>
>>>>     Object onActionFromButton2()
>>>>     {
>>>>         setBlockToRender(block2);
>>>>         return blockToRender;
>>>>     }
>>>>
>>>> }
>>>>
>>>> Component Class
>>>>
>>>> public class Myblock {
>>>>
>>>>     @Inject
>>>>     @Path("context:layout/scripts/jquery-1.3.2.min.js")
>>>>     private Asset jquery;
>>>>
>>>>     @Inject
>>>>     @Path("context:layout/scripts/pagination.js")
>>>>     private Asset pagination;
>>>>
>>>>     private RenderSupport rendersupport;
>>>>
>>>>     @BeginRender
>>>>     public void beginRender(){
>>>>         rendersupport.addScriptLink(jquery);
>>>>         rendersupport.addScriptLink(pagination);
>>>>     }
>>>> }
>>>>
>>>>
>>>> Howard Lewis Ship wrote:
>>>>>
>>>>> Search the archives, I'm pretty sure this has come up before.
>>>>>
>>>>> On Mon, Nov 23, 2009 at 3:24 PM, alanearl <alan-lua...@dash.com.ph>
>>>>> wrote:
>>>>>>
>>>>>> Sory Oakstair i did not detail my problem.
>>>>>> First I dont have any problem integrating Tapestry & JQuery.
>>>>>> My Problem is executing my javascript when it is inside the BLOCK.
>>>>>> I think it will not execute....
>>>>>>
>>>>>> Excuse me Sir Howard,
>>>>>>
>>>>>> I don't understand this part:
>>>>>>
>>>>>> This can be accomplished by using the Delegate component to call back
>>>>>> into your outer component (you have a getter method return an inner
>>>>>> class of type Renderable), and then you inject the stylesheets as
>>>>>> Assets and use RenderSupport to include them.
>>>>>>
>>>>>> What do you mean i need to create a new component then it will be
>>>>>> called
>>>>>> by
>>>>>> my page
>>>>>> using injectcomponent & put my javascript in the asset & use render
>>>>>> support?
>>>>>>
>>>>>> Sorry but Im confuse ...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Howard Lewis Ship wrote:
>>>>>>>
>>>>>>> The @IncludeJavascriptLibrary annotation changes the beginRender
>>>>>>> phase
>>>>>>> of your component to add the JavaScript.
>>>>>>>
>>>>>>> When a block within your component is rendered, the component's
>>>>>>> beginRender phase does not execute, just the
>>>>>>> beginRender phase of components *inside* the block.
>>>>>>>
>>>>>>> This can be accomplished by using the Delegate component to call
>>>>>>> back
>>>>>>> into your outer component (you have a getter method return an inner
>>>>>>> class of type Renderable), and then you inject the stylesheets as
>>>>>>> Assets and use RenderSupport to include them.
>>>>>>>
>>>>>>> On Sun, Nov 22, 2009 at 6:44 PM, alanearl <alan-lua...@dash.com.ph>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> My Question is when one of my block has jquery. It will not load
>>>>>>>> the
>>>>>>>> jquery
>>>>>>>> then action link perform.
>>>>>>>> Any help is appreciated.... Thanks!
>>>>>>>>
>>>>>>>> My Code .tml
>>>>>>>>
>>>>>>>>   <t:actionlink t:id="testPage" t:zone="output">
>>>>>>>>
>>>>>>>>   <t:zone t:id="output" t:update="show">
>>>>>>>>      Default
>>>>>>>>   <t:delegate to="prop:blockToRender" />
>>>>>>>>   </t:zone>
>>>>>>>>
>>>>>>>>   <t:block id="testBlock">
>>>>>>>>      <!-- With JQuery  it will not load the JQuery -->
>>>>>>>>      Test
>>>>>>>>   </t:block>
>>>>>>>>
>>>>>>>> My Class
>>>>>>>> @IncludeJavaScriptLibrary({"jquery-1.3.2.min.js","test.js"})
>>>>>>>>
>>>>>>>>   �...@injectcomponent
>>>>>>>>    private Zone output;
>>>>>>>>
>>>>>>>>   �...@inject
>>>>>>>>    private Block testBlock;
>>>>>>>>
>>>>>>>>    private Block blockToRender;
>>>>>>>>
>>>>>>>>    public Block getBlockToRender()
>>>>>>>>    {
>>>>>>>>        return blockToRender;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>    Object onActionFromtestPage()
>>>>>>>>    {
>>>>>>>>        blockToRender = testBlock;
>>>>>>>>        return blockToRender;
>>>>>>>>    }
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://old.nabble.com/Help-Tapestry5-Block-with-JavaScript--Anyone-tp26471839p26471839.html
>>>>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Howard M. Lewis Ship
>>>>>>>
>>>>>>> Creator of Apache Tapestry
>>>>>>>
>>>>>>> The source for Tapestry training, mentoring and support. Contact me
>>>>>>> to
>>>>>>> learn how I can get you up and productive in Tapestry fast!
>>>>>>>
>>>>>>> (971) 678-5210
>>>>>>> http://howardlewisship.com
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/Help-Tapestry5-Block-with-JavaScript--Anyone-tp26471839p26487973.html
>>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Howard M. Lewis Ship
>>>>>
>>>>> Creator of Apache Tapestry
>>>>>
>>>>> The source for Tapestry training, mentoring and support. Contact me to
>>>>> learn how I can get you up and productive in Tapestry fast!
>>>>>
>>>>> (971) 678-5210
>>>>> http://howardlewisship.com
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Help-Tapestry5-Block-with-JavaScript--Anyone-tp26471839p26492409.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Howard M. Lewis Ship
>> 
>> Creator of Apache Tapestry
>> 
>> The source for Tapestry training, mentoring and support. Contact me to
>> learn how I can get you up and productive in Tapestry fast!
>> 
>> (971) 678-5210
>> http://howardlewisship.com
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Help-Tapestry5-Block-with-JavaScript--Anyone-tp26471839p26605545.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to