You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Simon Raveh <Si...@nominum.com> on 2003/08/25 22:55:51 UTC

basic question

Hi,

first I would like to say,  I only started working with Tapestry few weeks
ago and already I can say that using component model save me a lot of code
copying, this is a great frame work to work with.

now for my basic question

I'm displaying records in a table, beside each record I have a checkbox for
multiple delete action.
The table is generated using a component similar to the browser component
which is used in the vlib application. I also insert an hidden field with an
ID for each record.
 my questions are:

1 How do I persist the selection in the checkbox if the user navigates to a
different page.
2 when submitting the form how do I know which of the checkboxes was
selected.
3 Can I map this check box to a hidden field inside the form.

from my html

<table width="100%" border="0" cellspacing="1" cellpadding="3"
class="fontcontent1">
	<tr jwcid="browser@Browser" query="ognl:query" value="ognl:currentMatch"
listener="ognl:listeners.requery" filter="ognl:filter" class="nonhighlight">
		<td width="3%"><input type="hidden" jwcid="@Hidden"
value="ognl:currentMatch.id" /><input 			type="checkbox"
jwcid="status"/></td>
								<td width="85%"><a jwcid="@DirectLink"
parameters="ognl:{currentMatch.id}"
listener="ognl:listeners.browseNetworksAcion" 		stateful="ognl:false"
class="small"><span jwcid="@Insert" value="ognl:currentMatch.name">block1
</span></a></td>
	<td align="center" width="12%"><img 	src="images/icons/drill_arrow.gif"
width="16" 		height="16" hspace="5"></td>
    	</tr>
</table>

Thanks
Simon



Re: ActionLink in Table results in StaleLinkException when caching is disabled

Posted by Jim Frederic <ji...@isogen.com>.
mb, thanks.  For now I've worked around the problem by using DirectLinks 
instead of ActionLinks, so the rewind is irrelevant.  Let me know if my 
investigating this further will help you out, though.

-Jim

Mindbridge wrote:

>Hi Jim,
>
>The problem in your case, I think, is that there is a difference in the
>TableModels during the render and the following rewind (when the ActionLink
>is invoked). The forms generated are thus different, the Form component
>notices the difference and throws the StaleLink exception.
>
>As it happens, I am just working on versions of the components that use
>ListEdit, etc. and will eliminate this problem completely. They are not
>ready yet though -- there are a few issues that need to be resolved.
>Hopefully, they would be ready for the next beta.
>
>In the mean time, please see if you could make sure that the TableModels
>during the render and rewind could be made identical. If there are, are
>there any other components within the Form that could create a difference?
>(e.g. a Conditional). This situation is actually likely if you happen to
>have properties that are not reinitialized during pageDetach() or
>initialize() -- that will make them keep their old values if they are
>cached, but reset them when disable-caching is used.
>
>If none of the above appears to be the culprit, please send the code -- we
>will try to determine the problem.
>
>Best regards,
>-mb
>
>
>----- Original Message ----- 
>From: "Jim Frederic" <ji...@isogen.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Tuesday, August 26, 2003 12:19 AM
>Subject: ActionLink in Table results in StaleLinkException when caching is
>disabled
>
>
>  
>
>>I have a page using a contrib:Table which I've modeled on the Table page
>>in the Workbench sample app.  It uses a custom component for
>>tableValues.  This custom tableValues is pretty much the same as the
>>standard TableValues, but with the rendered value wrapped in an
>>ActionLink.  The result is a table of links.  The curious thing is that
>>it works EXCEPT when I set org.apache.tapestry.disable-caching.  In that
>>case, clicking the links gives me a StaleLinkException, with a message
>>saying that the ActionId of the link I clicked maps to a different
>>component.
>>
>>The fact that it only fails when caching is disabled makes me suspect
>>something in the way table state is recorded.  For now I've replaced the
>>ActionLinks with DirectLinks and the problem is solved, but I'd still
>>like to understand what was going on.  Can anyone give me an idea why a
>>contrib:Table with ActionLinks would break when caching is disabled?
>>
>>Thanks,
>>-Jim
>>
>>
>>---------------------------------------------------------------------
>>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: ActionLink in Table results in StaleLinkException when caching is disabled

Posted by Mindbridge <mi...@yahoo.com>.
Hi Jim,

The problem in your case, I think, is that there is a difference in the
TableModels during the render and the following rewind (when the ActionLink
is invoked). The forms generated are thus different, the Form component
notices the difference and throws the StaleLink exception.

As it happens, I am just working on versions of the components that use
ListEdit, etc. and will eliminate this problem completely. They are not
ready yet though -- there are a few issues that need to be resolved.
Hopefully, they would be ready for the next beta.

In the mean time, please see if you could make sure that the TableModels
during the render and rewind could be made identical. If there are, are
there any other components within the Form that could create a difference?
(e.g. a Conditional). This situation is actually likely if you happen to
have properties that are not reinitialized during pageDetach() or
initialize() -- that will make them keep their old values if they are
cached, but reset them when disable-caching is used.

If none of the above appears to be the culprit, please send the code -- we
will try to determine the problem.

Best regards,
-mb


----- Original Message ----- 
From: "Jim Frederic" <ji...@isogen.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, August 26, 2003 12:19 AM
Subject: ActionLink in Table results in StaleLinkException when caching is
disabled


> I have a page using a contrib:Table which I've modeled on the Table page
> in the Workbench sample app.  It uses a custom component for
> tableValues.  This custom tableValues is pretty much the same as the
> standard TableValues, but with the rendered value wrapped in an
> ActionLink.  The result is a table of links.  The curious thing is that
> it works EXCEPT when I set org.apache.tapestry.disable-caching.  In that
> case, clicking the links gives me a StaleLinkException, with a message
> saying that the ActionId of the link I clicked maps to a different
> component.
>
> The fact that it only fails when caching is disabled makes me suspect
> something in the way table state is recorded.  For now I've replaced the
> ActionLinks with DirectLinks and the problem is solved, but I'd still
> like to understand what was going on.  Can anyone give me an idea why a
> contrib:Table with ActionLinks would break when caching is disabled?
>
> Thanks,
> -Jim
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


ActionLink in Table results in StaleLinkException when caching is disabled

Posted by Jim Frederic <ji...@isogen.com>.
I have a page using a contrib:Table which I've modeled on the Table page 
in the Workbench sample app.  It uses a custom component for 
tableValues.  This custom tableValues is pretty much the same as the 
standard TableValues, but with the rendered value wrapped in an 
ActionLink.  The result is a table of links.  The curious thing is that 
it works EXCEPT when I set org.apache.tapestry.disable-caching.  In that 
case, clicking the links gives me a StaleLinkException, with a message 
saying that the ActionId of the link I clicked maps to a different 
component.

The fact that it only fails when caching is disabled makes me suspect 
something in the way table state is recorded.  For now I've replaced the 
ActionLinks with DirectLinks and the problem is solved, but I'd still 
like to understand what was going on.  Can anyone give me an idea why a 
contrib:Table with ActionLinks would break when caching is disabled?

Thanks,
-Jim


RE: basic question

Posted by Simon Raveh <Si...@nominum.com>.
Hello Mindaugas,

Thanks very much for the information, the only reason I chose the checkbox
approach was to do a multiple delete. If you currently display 20 records
the user can select those he wants to delete and delete them in one shot.
Using direct links the user has to go and delete each record individually.

Thanks again
Simon


-----Original Message-----
From: Mindaugas Genutis [mailto:mindaugas@elinara.ktu.lt]
Sent: Tuesday, August 26, 2003 1:01 AM
To: Tapestry users
Subject: Re: basic question



Hello, Simon,

My colleague and me also adopted Tapestry less than a month ago. We also
have a table of records and basic functionality to add, remove and edit
each record.

With the help of this mailing list I'm almost finished with the Users
page. I could wrap it up and put it as an example.

We adopted a different approach. Instead of using a global <Form> tag we
use Tapestry DirectLink and ExternalLink components. We pass our record id
through them. If needed, the whole record object can be passed, though I'm
not sure if this is a good strategy.

The listener method of the page gets that ID and can do with the record
whatever is needed.

The drawback with the checkboxes in the table is that to delete a record
the user has to click on the checkbox and then click delete. In our
approach the user just clicks the "Delete" link.

I could zip the necessary files and put them somewhere for you. I think
this could be a good example for Tapestry starters.

Best Regards,

Mindaugas

> Hi,
>
> first I would like to say,  I only started working with Tapestry few weeks
> ago and already I can say that using component model save me a lot of code
> copying, this is a great frame work to work with.
>
> now for my basic question
>
> I'm displaying records in a table, beside each record I have a checkbox
for
> multiple delete action.
> The table is generated using a component similar to the browser component
> which is used in the vlib application. I also insert an hidden field with
an
> ID for each record.
>  my questions are:
>
> 1 How do I persist the selection in the checkbox if the user navigates to
a
> different page.
> 2 when submitting the form how do I know which of the checkboxes was
> selected.
> 3 Can I map this check box to a hidden field inside the form.
>
> from my html
>
> <table width="100%" border="0" cellspacing="1" cellpadding="3"
> class="fontcontent1">
> 	<tr jwcid="browser@Browser" query="ognl:query" value="ognl:currentMatch"
> listener="ognl:listeners.requery" filter="ognl:filter"
class="nonhighlight">
> 		<td width="3%"><input type="hidden" jwcid="@Hidden"
> value="ognl:currentMatch.id" /><input 			type="checkbox"
> jwcid="status"/></td>
> 								<td width="85%"><a jwcid="@DirectLink"
> parameters="ognl:{currentMatch.id}"
> listener="ognl:listeners.browseNetworksAcion" 		stateful="ognl:false"
> class="small"><span jwcid="@Insert" value="ognl:currentMatch.name">block1
> </span></a></td>
> 	<td align="center" width="12%"><img 	src="images/icons/drill_arrow.gif"
> width="16" 		height="16" hspace="5"></td>
>     	</tr>
> </table>
>
> Thanks
> Simon

--
Kaunas Regional Distance Education Center
Programmer
Phone: +370 674 05232
WWW: http://distance.ktu.lt


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


Re: basic question

Posted by Mindaugas Genutis <mi...@elinara.ktu.lt>.
Hello, Simon,

My colleague and me also adopted Tapestry less than a month ago. We also 
have a table of records and basic functionality to add, remove and edit 
each record.

With the help of this mailing list I'm almost finished with the Users 
page. I could wrap it up and put it as an example.

We adopted a different approach. Instead of using a global <Form> tag we 
use Tapestry DirectLink and ExternalLink components. We pass our record id 
through them. If needed, the whole record object can be passed, though I'm 
not sure if this is a good strategy.

The listener method of the page gets that ID and can do with the record 
whatever is needed.

The drawback with the checkboxes in the table is that to delete a record 
the user has to click on the checkbox and then click delete. In our 
approach the user just clicks the "Delete" link.

I could zip the necessary files and put them somewhere for you. I think 
this could be a good example for Tapestry starters.

Best Regards,

Mindaugas

> Hi,
> 
> first I would like to say,  I only started working with Tapestry few weeks
> ago and already I can say that using component model save me a lot of code
> copying, this is a great frame work to work with.
> 
> now for my basic question
> 
> I'm displaying records in a table, beside each record I have a checkbox for
> multiple delete action.
> The table is generated using a component similar to the browser component
> which is used in the vlib application. I also insert an hidden field with an
> ID for each record.
>  my questions are:
> 
> 1 How do I persist the selection in the checkbox if the user navigates to a
> different page.
> 2 when submitting the form how do I know which of the checkboxes was
> selected.
> 3 Can I map this check box to a hidden field inside the form.
> 
> from my html
> 
> <table width="100%" border="0" cellspacing="1" cellpadding="3"
> class="fontcontent1">
> 	<tr jwcid="browser@Browser" query="ognl:query" value="ognl:currentMatch"
> listener="ognl:listeners.requery" filter="ognl:filter" class="nonhighlight">
> 		<td width="3%"><input type="hidden" jwcid="@Hidden"
> value="ognl:currentMatch.id" /><input 			type="checkbox"
> jwcid="status"/></td>
> 								<td width="85%"><a jwcid="@DirectLink"
> parameters="ognl:{currentMatch.id}"
> listener="ognl:listeners.browseNetworksAcion" 		stateful="ognl:false"
> class="small"><span jwcid="@Insert" value="ognl:currentMatch.name">block1
> </span></a></td>
> 	<td align="center" width="12%"><img 	src="images/icons/drill_arrow.gif"
> width="16" 		height="16" hspace="5"></td>
>     	</tr>
> </table>
> 
> Thanks
> Simon

-- 
Kaunas Regional Distance Education Center
Programmer
Phone: +370 674 05232
WWW: http://distance.ktu.lt