You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Henrique Boregio <hb...@gmail.com> on 2009/04/15 16:10:47 UTC

Passing hidden parameters / bookmarkable links

I am developing a system that has "groups" and want to make them
accesible via user-friendly urls such as

www.mysite.com/group/GROUPNAME

On a web page, I have a list of groups which are all links to their
group pages, such as:
www.mysite.com/group/groupA
www.mysite.com/group/groupB
...

This is implemented as such:
PageParameters parameters = new PageParameters();
parameters.put("groupName", aGroup.getName());
add(new BookmarkablePageLink("groupName", GroupHomePage.class, parameters));

and also mounting a BookmarkablePage in my Wicket Application
mountBookmarkablePage("/groups", GroupHomePage.class);

and in my GroupHomePage class, I have:
public GroupHomePage (final PageParameters parameters) {

    	String groupName = parameters.getString("groupName");
    	int groupId = GroupDAO.getGroupId(groupName);
}

So as you can see, I basically retrieve the groupName and go fetch the
groupId from the database.
I already know the groupId from the page I was coming from so there is
no need to go back to the databse.

How can I pass this groupId parameter to GroupHomePage without
compromising the user-friendly links such as
www.mysite.com/group/groupName?
Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Passing hidden parameters / bookmarkable links

Posted by Jeremy Thomerson <je...@wickettraining.com>.
You can't - it's either in the URL and accessible or not.  If you only want
to pass the group name, then the group name needs to be unique so that you
can look it up.  Otherwise, you have to pass the ID and the name.  At that
point, the name is just for SEO or prettyness - whatever - because the ID is
what you'll have to use.

You can also do something like foo.com/group/234-groupName

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Apr 15, 2009 at 9:10 AM, Henrique Boregio <hb...@gmail.com>wrote:

> I am developing a system that has "groups" and want to make them
> accesible via user-friendly urls such as
>
> www.mysite.com/group/GROUPNAME
>
> On a web page, I have a list of groups which are all links to their
> group pages, such as:
> www.mysite.com/group/groupA
> www.mysite.com/group/groupB
> ...
>
> This is implemented as such:
> PageParameters parameters = new PageParameters();
> parameters.put("groupName", aGroup.getName());
> add(new BookmarkablePageLink("groupName", GroupHomePage.class,
> parameters));
>
> and also mounting a BookmarkablePage in my Wicket Application
> mountBookmarkablePage("/groups", GroupHomePage.class);
>
> and in my GroupHomePage class, I have:
> public GroupHomePage (final PageParameters parameters) {
>
>        String groupName = parameters.getString("groupName");
>        int groupId = GroupDAO.getGroupId(groupName);
> }
>
> So as you can see, I basically retrieve the groupName and go fetch the
> groupId from the database.
> I already know the groupId from the page I was coming from so there is
> no need to go back to the databse.
>
> How can I pass this groupId parameter to GroupHomePage without
> compromising the user-friendly links such as
> www.mysite.com/group/groupName?
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>