I got something working with the example code below (Hello.class is
bookmarkable and mounted). What we would need in Wicket is a
BookmarkableForm class:
StatelessForm form = new StatelessForm("form") {
@Override
protected void onComponentTag(final ComponentTag tag) {
super.onComponentTag(tag);
tag.put("action", urlFor(Hello.class, new
PageParameters()));
}
@Override
protected void onComponentTagBody(final MarkupStream
markupStream,
final ComponentTag openTag) {
super.renderComponentTagBody(markupStream,
openTag);
}
};
I'm not sure that's the best way but I wanted to avoid calling
onComponentTagBody in Form which generates the hidden fields. Ideally, I
should use a WebMarkupContainer but, as you noticed, it adds the changes the
elementname with formname:elementname. Somehow, the Form class manages to
avoid this even though it inherits WebMarkupContainer but I couldn't figure
out. Does anyone now how it does this?
Thanks,
Catalin
Doug Donohoe 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-tp16912974p16992741.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]