I'd go for either the option that Jonathan suggested (providing your own Panel for a node), or - just as easy - create a special Page, that has the redirect in it:

<html>
<head>
<meta wicket:id="redirect" http-equiv="refresh" content="0; url=app">
</head>
</html>

On this page, you add:

WebMarkupContainer redirect = new WebMarkupContainer("redirect");
redirect.add(new AttributeModifier("content", new Model("0; url=http://www.google.com";)));
add(redirect);


One other trick, and I am *not* recommending this, but if you want to redirect to a resource outside Wicket but within the same server, you could use:

HttpServletRequest httpServletRequest = ((WebRequest)getRequest()).getHttpServletRequest();
HttpServletResponse httpServletResponse = ((WebResponse)getResponse()).getHttpServletResponse();
RequestDispatcher dispatcher = httpServletRequest.getRequestDispatcher("/otherstuff.jsp");
dispatcher.forward(httpServletRequest, httpServletResponse)


Though I think the first option is much better.

Regards,

Eelco

Jonathan Locke wrote:


eelco is Mr. Tree, so i'm guessing... but try overriding Tree.newNodePanel() and in that method create a panel with an ordinary ExternalLink (see Linkomatic example) in it. make sense?


bin zhu wrote:

how do i redirect to outside of wicket?
for example, i want to go to an external link when the
user clicks on a tree node

redirectTo only accepts Page objects. should i create
an ExternalPage object that can redirect calls ? ie..
redirectTo( new ExternalPage("http://www.google.com";)
);

thanks,

bin




------------------------------------------------------- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to