No one knows what's wrong?
Tom
Thomas Singer wrote:
> OK, I've tried to create an unversioned page to keep the URL stable using
> following page code:
>
>> public class DownloadFile extends TemplatePage {
>>
>> // Constants
>> ==============================================================
>>
>> private static final String FILE_PARAMETER = "file";
>>
>> // Static
>> =================================================================
>>
>> public static BookmarkablePageLink createLinkToPage(String id, String
>> file) {
>> final BookmarkablePageLink pageLink = new
>> BookmarkablePageLink(id, DownloadFile.class);
>> pageLink.setParameter(FILE_PARAMETER, file);
>> return pageLink;
>> }
>>
>> // Setup
>> ==================================================================
>>
>> public DownloadFile(PageParameters parameters) {
>> final String file = parameters.getString(FILE_PARAMETER);
>> if (file == null) {
>> throw new
>> RestartResponseAtInterceptPageException(Download.class);
>> }
>>
>> if (!getOurSession().isLicenseAgreed()) {
>> addContent(createLicenseFragment("contentPanel",
>> parameters));
>> throw new RestartResponseAtInterceptPageException(this);
>> }
>>
>> addContent(createDownloadFragment("contentPanel", file));
>> }
>>
>> // Utils
>> ==================================================================
>>
>> private Fragment createDownloadFragment(String id, String file) {
>> final Fragment fragment = new Fragment(id, "downloadFragment");
>> fragment.add(new Label("file", file));
>> return fragment;
>> }
>>
>> private Fragment createLicenseFragment(String id, final PageParameters
>> parameters) {
>> final Fragment fragment = new Fragment(id, "licenseFragment");
>> fragment.add(new PageLink("accept", new IPageLink() {
>> public Page getPage() {
>> getOurSession().setLicenseAgreed(true);
>> return new DownloadFile(parameters);
>> }
>>
>> public Class getPageIdentity() {
>> return DownloadFile.class;
>> }
>> }));
>> return fragment;
>> }
>>
>> public boolean isVersioned() {
>> return false;
>> }
>> }
>
> Every page is mounted with QueryStringUrlCodingStrategy. On the Download
> page a link to this DownloadFile page is created using the above
> createLinkToPage() static method call which creates a link to
> "http://localhost:8080/smartcvs/download-file.html?file=win32jre"
> Curiously, when I click on it, the browser displays
> "http://localhost:8080/?wicket:interface=:2::" as URL. The "accept"-link
> occurs pointing to
> "http://localhost:8080/?wicket:interface=:2:border:contentPanel:accept::ILinkListener".
>
> When I click it, the browser displays
> "http://localhost:8080/?wicket:interface=:3::" as URL. Clicking the
> back-button shows the "http://localhost:8080/?wicket:interface=:2::" page
> with the "accept"-link, no matter whether I try it with Opera or FireFox.
>
> Tom
>
>
> Eelco Hillenius wrote:
>>> Regarding the back-button: it would be the best if the intermediate license
>>> agreement page would not occur when pressing the back-button, but instead
>>> the previous page (if any). Is something like that possible?
>> What you need to achieve is that the URL stays stable. One way to
>> achieve this is to use panel replacement. E.g. when you click the
>> download page, you replace the main panel on your page with a panel
>> that displays the license agreement. If you turn off versioning for
>> that page, the URL will stay stable and thus if you push the back
>> button later, your browser will return to the first version of the
>> page. I think this should work for most browsers (maybe only not with
>> Opera). There are alternative ways to do this, including throwing
>> RestartResponseExceptions, using custom page factories and custom url
>> coding strategies. Or you can trick the browser using JavaScript, of
>> which I don't know too many details.
>>
>> Eelco
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user