Demo applicaitons code base.

Hi ,

I am very new to vaadin and I really liked the concept used.

I am currently evaluating this software for one of my project. and wanted to know if we can download the code base of the sample applications posted in the site.

I was curious to know how we could make use of the classes which we create using the Vaadin Composite. Is there a way by which we can have the multiple classes in the configured in web.xml. Also it would be good if you can point me to a particular link/tutorial where we have Vaadin based projects which contains multiple classes and interactions between them.

Thanks
Chetan

The sources for the demo applications can be found in the public svn repository. The repository can be browsed at
http://dev.vaadin.com/browser/demo
and checked out from http://dev.vaadin.com/svn/demo

Regarding you question about multiple classes in web.xml, I’d say that the simple case is to only deploy one Vaadin application per .war file, and thus every application runs in it’s own context.

Book of Vaadin contains multiple different examples of applications of varying complexity. The book can be browsed online at
https://vaadin.com/book

And just to clarify this as the original poster might have been thinking about this from a JSP point of view:
A Vaadin application is not a single “page” or view, but can have many views, complex navigation within the application etc.

In many cases, you don’t need multiple applications for a system.

Offhand, I’d think you never actually
need
more than one application. But if you have systems that are very different from each other, then it may be a better OO design to have multiple application classes than to check the URL and have an if-else tree for the proper logic to load. A candidate for this could be user provisioning. You may write a module that handles registration of users or new user validation (when users click a link in their email to finalize registration) and use this registration code in more than one web app.

Something along the lines of (in web.xml):

    <servlet-mapping>
        <servlet-name>MyMainServlet</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>MyRegistrationServlet</servlet-name>
        <url-pattern>/user/*</url-pattern>
    </servlet-mapping>

That lets the container do a little bit of logic for you and buys you some code reuse. You may just need to specify some deployment property to tell the registration module which style to use to match the main app. The two Vaadin Application classes wouldn’t really need to share any info in this particular case since the registration module only runs to log in the new user, but you could have the servlets share information in any of the normal ways (e.g. ServletContext).

Are others using a similar pattern, or do most people just use the one servlet for the whole web app?

Cheers,
Bobby