Re: setResponsePage() and mounted URLs

2009-04-05 Thread Johan Compagner
what happens if you try this:

add(new StatelessLink(statelessPage1

 ) {
public void onClick() {
setResponsePage(StatelessPage1.class);

RequestCycle.get().setRedirect(true)


}



johan

On Sun, Apr 5, 2009 at 05:38, Matthew Welch matt...@welchkin.net wrote:

 My mounted pages work perfectly when I use a BookmarkablePageLink to them,
 however I am having difficulty when I try to use setResponsePage() to those
 same pages. Here's a snipped that I pulled from a Quickstart I'm using to
 figure out where I'm going wrong:

setStatelessHint(true);

add(new StatelessLink(statelessPage1) {
public void onClick() {
setResponsePage(StatelessPage1.class);
}
});

add(new BookmarkablePageLink(statelessPage1-2,
 StatelessPage1.class));


 The second link produces a nice clean link URL like 
 http://localhost:8080/statelessapp/stateless1;, however the first produces
 a
 much less desirable 

 http://localhost:8080/statelessapp/?wicket:bookmarkablePage=:com.mycompany.HomePagewicket:interface=:0:statelessPage1::ILinkListener
 :
 :.

 In this simplified example I could clearly use a BookmarkablePageLink in
 both situations, however in my real app the logic to determine where a
 particualr link needs to go a is occassional conditional so I end up with
 something like:

add(new StatelessLink(statelessPage1) {
public void onClick() {
if(somethingIsTrue){
setResponsePage(StatelessPage1.class);
}else{
setResponsePage(StatelessPage2.class);
}
}
});

 Can someone put me on the right path to using mounted URLs with
 setResponsePage()?

 Matt



Re: setResponsePage() and mounted URLs

2009-04-05 Thread Matt Welch


jcompagner-2 wrote:
 
 what happens if you try this:
 
 add(new StatelessLink(statelessPage1

 ) {
public void onClick() {
setResponsePage(StatelessPage1.class);
 
 RequestCycle.get().setRedirect(true)
 

}
 
While the link on the original page is still the long version, once it is
clicked I do end up on page with the nicely mounted URL. Thanks!

Are there any gotchas I need to look out for when using this approach?

Matt
-- 
View this message in context: 
http://www.nabble.com/setResponsePage%28%29-and-mounted-URLs-tp22890145p22901802.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: setResponsePage() and mounted URLs

2009-04-04 Thread Igor Vaynberg
statelesslink is just like link - it produces a callback url. for your
situation you may be able to use externallink and provide it a model
that can dynamically build a bookmarkable url that you need. to build
the url just call urlfor(pageclass, pageparams) on any component.

-igor

On Sat, Apr 4, 2009 at 8:38 PM, Matthew Welch matt...@welchkin.net wrote:
 My mounted pages work perfectly when I use a BookmarkablePageLink to them,
 however I am having difficulty when I try to use setResponsePage() to those
 same pages. Here's a snipped that I pulled from a Quickstart I'm using to
 figure out where I'm going wrong:

        setStatelessHint(true);

        add(new StatelessLink(statelessPage1) {
            public void onClick() {
                setResponsePage(StatelessPage1.class);
            }
        });

        add(new BookmarkablePageLink(statelessPage1-2,
 StatelessPage1.class));


 The second link produces a nice clean link URL like 
 http://localhost:8080/statelessapp/stateless1;, however the first produces a
 much less desirable 
 http://localhost:8080/statelessapp/?wicket:bookmarkablePage=:com.mycompany.HomePagewicket:interface=:0:statelessPage1::ILinkListener:
 :.

 In this simplified example I could clearly use a BookmarkablePageLink in
 both situations, however in my real app the logic to determine where a
 particualr link needs to go a is occassional conditional so I end up with
 something like:

        add(new StatelessLink(statelessPage1) {
            public void onClick() {
                if(somethingIsTrue){
                    setResponsePage(StatelessPage1.class);
                }else{
                    setResponsePage(StatelessPage2.class);
                }
            }
        });

 Can someone put me on the right path to using mounted URLs with
 setResponsePage()?

 Matt


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