mountBookmarkablePage is a convenience method for mounting the most common URL 
form.

Look here for more info: 
https://cwiki.apache.org/WICKET/url-coding-strategies.html

You can also create your and mount your own URL decoding strategies.

----- Original Message -----
From: "Mike Quilleash" <mike.quille...@junifersystems.com>
To: users@wicket.apache.org
Sent: Friday, 28 May, 2010 11:43:00 AM
Subject: RE: Basic page routing

OK it seems I was missing the concept of bookmarkable page.

Adding the following line into my Application.init() solved it for that
page.

mountBookmarkablePage( "/HomePage", HomePage.class );

I guess the default wicket config is to only allow direct URL access via
the "/" homepage and everything then navigates from there. To allow
additional direct URLs they need to be "mounted".

-----Original Message-----
From: Mike Quilleash [mailto:mike.quille...@junifersystems.com]
Sent: den 27 maj 2010 19:34
To: users@wicket.apache.org
Subject: Basic page routing

Hi all,

I'm a new user to wicket. I'd heard some good things about it so I
thought I'd try it out for a mini-web project I have.

Using Wicket 1.4.18 and Java 6. I have an existing application using
Spring (@Autowired everywhere) and I want to use some of the existing
spring beans.

In the short term I've got an existing set of static web pages done by a
web designer as a template that I want to have the content driven from
our DB. Wicket seemed like a good choice because it doesn't touch the
view file much (add some wicket:id attributes).

I've got a basic Application up, running on embedded Jetty server, with
a welcome page which use @SpringBean to inject a couple of beans. That
all works fine.

However I can't figure out how to get URLs other than / to work. If I go
http://localhost:9090/ it works ok, I get the welcome page and the Java
executes. If I go to http://localhost:9090/HomePage.html it renders the
page but doesn't invoke the wicket Java component so the label doesn't
get rendered with the correct text. I'm sure this is incredibly basic,
but how do I get this to work properly?

Cheers.


My Application and home page classes below + web.xml.


// application class
public class WebPortalApplication extends WebApplication
{ public Class<? extends Page> getHomePage()
{ return HomePage.class;
}

@Override
protected void init()
{ ClassPathXmlApplicationContext applicationContext = new
ClassPathXmlApplicationContext( "META-INF/config/spring/web-portal.xml"
); applicationContext.start();

addComponentInstantiationListener( new SpringComponentInjector( this,
applicationContext, false ) );
} }


// home page
public class HomePage extends WebPage
{ @SpringBean
private HibernateOperations hibernateOperations;

public HomePage()
{ add( new Label( "message", "Hello World!" ) );
} }



// web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd";>

<web-app>
<display-name>Wicket Examples</display-name>
<filter> <filter-name>HelloWorldApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param> <param-name>applicationClassName</param-name>
<param-value>com.xxx.webportal.WebPortalApplication</param-value>
</init-param> </filter>
<filter-mapping> <filter-name>HelloWorldApplication</filter-name>
<url-pattern>/*</url-pattern> </filter-mapping>
</web-app>

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

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

Reply via email to