Setting the action to the page URL doesn't quite work with default wicket
URLs since they pass information in the query string and browsers ignore
anything after the '?' in a GET action.

I'd have to set some hidden fields like wicket:bookmarkablePage=[.....] as
well as the other fields the page depends on (anything in PageParameters). 
I haven't pursued this yet, but will.  I'm not sure if Form has a way to add
arbitrary hidden fields.

Another problem with using a WebMarkupContainer instead of a form is that
the form children get renamed to 'form:days' and 'form:games' instead of
just 'days' and 'games'.  I haven't looked into that either.  The issue with
this is that the params come down as form:days=X&form:games=Y instead of
just days=X&games=Y.

For posterity, I've documented most of my lessons on my wiki:

http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=Main

-Doug


Johan Compagner wrote:
> 
> What you want is just stateless forms, but if you just want to do a
> get to a page then your page with the form can be really simple
> 
> Just 1 markup container for the form tag that just has an atribute
> modifier that sets the action to the page url.
> 
> On 4/29/08, Doug Donohoe <[EMAIL PROTECTED]> wrote:
>>
>> Obviously, if you post with "GET" method, you don't get those dialogs.  
>> A
>> post and redirect means two hits to the server where-as a GET is only
>> one.
>> Using the GET method makes your average web page bookmarkable.
>>
>> The code I used was basically this:
>>
>>    super.onComponentTag(tag)
>>    tag.put("action", urlFor(Foo.class, params);
>>
>> That doesn't work.  It still submits using the 'interface' stuff -
>> apparently because of hidden fields.  I tried using a WebMarkupContainer
>> instead of a form, but that fails due to the ? in the URL.  Also, for
>> some
>> reason the form elements are renamed 'formname:elementname' when using a
>> WebMarkupContainer.
>>
>> I really like Wicket quite a bit, but this issue with forms and constant
>> 'session expired' messages are my biggest sticking point.
>>
>> -Doug
>>
>>
>> igor.vaynberg wrote:
>> >
>> > thats what stateless forms are for. after a submit you want a redirect
>> > anyways so that a refresh doesnt popup that annoying post values
>> > dialog.
>> >
>> > overriding oncomponenttag() should work just fine, you just have to
>> > make sure to call super first.
>> >
>> > -igor
>> >
>> >
>> > On Mon, Apr 28, 2008 at 7:08 PM, Doug Donohoe <[EMAIL PROTECTED]>
>> wrote:
>> >>
>> >>  Overriding onComponentTag doesn't seem to work.  The URL that gets
>> >> generated
>> >>  (using urlFor) starts with a question mark which isn't included when
>> the
>> >>  form is submitted.   The only thing passed down is the form
>> parameters,
>> >>  which obviously doesn't work since the page is missing.  I'm using
>> the
>> >>  default URL encoding strategy - was saving that investigation for
>> later.
>> >>  Maybe I need to bump that up in the queue.
>> >>
>> >>  I'll also look at using a stateless form next (and redirecting to a
>> >>  bookmarkable page so the URL is nice).
>> >>
>> >>  Just a general comment on this.  I basically want a form that can be
>> >>  submitted at any time, regardless if a session is there or not.  
>> This
>> >> is a
>> >>  common use case (e.g., google, login, search) and for all the
>> excellent
>> >>  stuff in wicket, this seems very hard to do.
>> >>
>> >>  Does anyone else have advice on how to do nice-looking-urls using
>> >> GET-method
>> >>  form posts?  In other words, if I wanted to build Google's home page
>> in
>> >>  wicket and be able to bookmark search results, how would I do it?  If
>> >> anyone
>> >>  has an example they can share, I would appreciate it.
>> >>
>> >>  Regards,
>> >>
>> >>  -Doug
>> >>
>> >>
>> >>
>> >>
>> >>  igor.vaynberg wrote:
>> >>  >
>> >>  > override the form's action value in its oncomponenttag callback
>> with a
>> >>  > url to a bookmarkable page. but then you have to parse all posted
>> >>  > values yourself.
>> >>  >
>> >>  > if you dont care about the url you can use a statelessform instead
>> and
>> >>  > probably avoid a bunch of headache.
>> >>  >
>> >>  > -igor
>> >>  >
>> >>  >
>> >>  > On Sat, Apr 26, 2008 at 6:36 AM, Doug Donohoe <[EMAIL PROTECTED]>
>> >> wrote:
>> >>  >>
>> >>  >>  Hi,
>> >>  >>
>> >>  >>  I'm like to submit a form using bookmarkable page style, so that
>> >>  >>
>> >>  >>  a) the form can always be submitted, regardless if the session is
>> >>  >> expired or
>> >>  >>  not (think of a Google search submission e.g.,
>> >>  >>  http://www.google.com/search?q=wicket)
>> >>  >>
>> >>  >>  b) the form remembers PageParameters that were there when the
>> page
>> >> was
>> >>  >>  generated (think of google advanced search where you change the
>> >> number
>> >>  >> of
>> >>  >>  items per page and that is remembered in subsequent searches
>> e.g.,
>> >>  >>  http://www.google.com/search?q=wicket&num=30)
>> >>  >>
>> >>  >>  How do I tell the form to submit using bookmarkable format (using
>> >> the
>> >>  >>  assigned URL encoding strategy)?
>> >>  >>
>> >>  >>  Thanks,
>> >>  >>
>> >>  >>  -Doug
>> >>  >>  --
>> >>  >>  View this message in context:
>> >>  >>
>> >>
>> http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16912974.html
>> >>  >>  Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>  >>
>> >>  >>
>> >>  >>
>> >> ---------------------------------------------------------------------
>> >>  >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >>  >>  For additional commands, e-mail: [EMAIL PROTECTED]
>> >>  >>
>> >>  >>
>> >>  >
>> >>  >
>> ---------------------------------------------------------------------
>> >>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >>  > For additional commands, e-mail: [EMAIL PROTECTED]
>> >>  >
>> >>  >
>> >>  >
>> >>
>> >>  --
>> >>  View this message in context:
>> >>
>> http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16951990.html
>> >>
>> >>
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >>  ---------------------------------------------------------------------
>> >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >>  For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16952274.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16984089.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to