Hi all.
I am new to the web development and therefore to tapestry. I have a general 
question.
I am developing a component to implement a page selector mechanism. The 
component consist of html templet, *.jwc , and *.java files. The design I 
have in mind is very simple:
Page displays the contents of the file. File length consists of 'n' pages.
Tapestry page creates an object (this object created only once) and stores 
the data about the file (like current page number, total pages, and so on) 
in that object.
Then Tapestry page gets current page number and displays the content of the 
file on that page, and just after that includes component (all this I think 
takes place at render time).
Component receives this object (with data in it) as a parameter. Takes the 
data and produces array of numbers, which are displayed as links. User 
chooses a desirable number by clinking on that number.
Here I have difficulties. There are three ways (that I am aware of at this 
moment) how to handle this.

1.Using Direct Link service. When I try that, I am getting null pointer 
exception. My page observes changes in setObject method, and implements 
detach by setting (object=null). So if I understand correctly the cycle 
begins with setting the object whatever was stored before, getting current 
page number from that object and displaying it, then including component and 
passing the object to it, component does it's thing then everything renders, 
Tapestry page returns to pool through detach.
When the direct Link is clicked the following actions are taking place:
The Tapestry page calls it's mutators and I think restores the state. Then 
the control proceeds from the direct link �listener method� which is setting 
new current page (user clicked on) on the object that is null, because it is 
just been pooled out from the pool (I assume).
So this approach (at least for me) implies using visit object. Which is 
central to the component, but is there is any other way (more elegant 
solution) to that problem?

2. Using Action Link I am facing another problem, it seems to be impossible 
to distinguish between refresh and last command in the URL. So if this last 
command appears to be increment page number by one, by hitting refresh I can 
walk through document.
(May be I am just not experienced enough), but I do not see the solution to 
this.

3. Using �Form� component in combination with �Submit or ImageSubmit� 
component, but here I am bounded to bottom or Image but all I want is simple 
link which seems to be very difficult to achieve with out changing the 
source code as indicated in a mail archive.

All I want to do is to implement this component as a separate module (not 
coupled with �visit�). My problem is, I do not want the visit object to be 
involved because info in a visit object is central to whole application, but 
this component only appears when user want to display a file.
I will really appreciate any input.
Sorry for a long mail folks.
Thanks.


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to