I'm not keen on the named context parameters idea. There's a
persuasive argument for putting filter parameters into the query
string portion of the URL instead of in the context. http://blpsilva.wordpress.com/2008/04/05/query-strings-in-restful-web-services/
So you get a URL like this
http://localhost:8080/myapp/mypage?firstname=Humpty&lastname=Dumpty
instead of this
http://localhost:8080/myapp/mypage/firstname/Humpty/lastname/Dumpty
It's easy enough to do:
@Inject
private ComponentResources _componentResources;
@Inject
private Request _request;
public Link set(String firstName, String lastName) {
Link link = _componentResources.createPageLink(this.getClass(),
true);
if (firstName != null) {
link.addParameter("firstname", firstName);
}
if (lastName != null) {
link.addParameter("lastname", lastName);
}
return link;
}
void onActivate() {
_firstName = _request.getParameter("firstname");
_lastName = _request.getParameter("lastname");
}
On 11/10/2008, at 12:37 AM, Joel Halbert wrote:
I tend to try and keep all my pages as stateless as possible, you
can then quite easily require a few query string parameters per page
when this is the case, consider the case of browsing a storefront -
you need a "category id" (e.g. books, shoes), a page number (for the
current page if looking at paginated data) and a "sort by" field
(for the clients sort by selection). Already we have 3. There can
easily be more, say if the client is "filtering" the view.
Thiago H. de Paula Figueiredo wrote:
Em Fri, 10 Oct 2008 09:58:23 -0300, Joel Halbert <[EMAIL PROTECTED]
> escreveu:
I was wondering whether anyone missed the lack of direct support
for named context parameters?
I try to keep my pages as stateless as possible (thus
bookmarkable) and better support for "named" context variables
would make this much easier.
I haven't missed named context parameters because my pages, almost
all the time, need just one parameter, sometimes two, so there is
no need to name them.
--
SU3 Analytics Ltd
61b Oxford Gardens
W10 5UJ
London
Tel: +44 20 8960 2634
Mob: +44 75 2501 0825
www.su3analytics.com
SU3 Analytics Ltd is a company registered in England and Wales under
company number 06639473 at registered address 61b Oxford Gardens,
London W10 5UJ, United Kingdom.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]