That is not the Tapestry Way ... Tapestry will largely
shield you from having to deal query parameters.
However, any URL generated by DirectLink is not
bookmarkable ... because it includes things like
component ids that are subject to change.
In 2.1, the Virtual Library implements an "external"
service that was bookmarkable.
For 2.2, this has been generalized and moved into the
framework.
In your case, you want to identify, in the URL, the item
to display (i.e., its primary key), the detail level
(full, medium, small?) and, probably, the type of the
item.
In the Vlib, the type of item was implicit in the page
selected to display it ... that is, I didn't encode an
object type ("Person" or "Book") I encoded a page name
("ViewPerson" or "ViewBook").
Depending on the number of item types and the number of
pages to display them you'll have to decide on a
strategy.
Generally, simple strings that contain URL safe
characters (generally, a-z A-Z 0-9 . - _) can be stored
in the service context. The context is an array of
strings. Tapestry frequently uses the context to store
page names and component ids.
Anything more complicated should go into the service
parameters. Service parameters start as Object[] but
are "squeezed" into String[] for encoding in the URL ...
then converted back to Object[] when the link is
clicked. Basically, there's a string representation
that encodes the object type.
--
[EMAIL PROTECTED]
http://tapestry.sf.net
> Hello Tapestry-developers,
>
> I've got a question.
> For example a have a "Diff" page with 3 buttons.
> Full - show full item description
> Middle - show middle item description
> Short - show short item description
>
> And when one of buttons is pressed, the next page ("ItemShower")have to show
> item by
> condition.
>
> So my task is to determine which button was pressed on "Diff" page.
> It's easy to do it like this:
>
> In Diff:
> public void showFull(IRequestCycle cycle) throws RequestCycleException {
> Visit visit = (Visit)getVisit();
> visit.setDescriptionLevel("full")
> cycle.setPage("ItemShower");
> }
>
> and I get this value from Visit and render "ItemShower".
>
> But if session is over, i loose "description level". Or if user make
> bookmark on url like below, i can't display right page. So i need to save
> it in url. now when i pressed Full Button i have such url
> http://localhost:8082/item?service=direct&context=Diff%2FchooseForm¶meters=0
> &fullButton=Full&Form0=3
> and then in "ItemShower"
> protected void renderComponent(IMarkupWriter iMarkupWriter, IRequestCycle
> iRequestCycle) throws RequestCycleException {
> Object fullIF =
> iRequestCycle.getRequestContext().getRequest().getParameter("fullButton");
> if(fullIF != null)
> setFullIF(true);
> ...
> super.renderComponent(iMarkupWriter, iRequestCycle);
> }
>
> so i don't need session any more, but is it right way ????
>
> --
> Best regards,
> DarkIT mailto:[EMAIL PROTECTED]
>
>
>
>
> -------------------------------------------------------
> In remembrance
> www.osdn.com/911/
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer
-------------------------------------------------------
In remembrance
www.osdn.com/911/
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer