Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Working together with Struts2

Aladdin Özenir
1 decade ago Mar 17, 2010 1:07pm

Hello everyone,

I am testing the Vaadin Frameork at the moment.
My evaluation is using the Eclipse IDE and Apache Tomcat.

Currently we are working with a self-written Framework, based on technologies like Spring Framework and Struts2.
My question here is primarily concerning Struts2.

But first, I want to tell you, that in my first test I have used the Sample Application called "AddressBook", which you provide in your tutorial, which is great!.

When I create a new Vaadin Project in the Eclipse IDE with the project wizard and use your AddressBook application, it works fine. Everything is displayed correctly.

But, when I create the SAME application (manually, of course, as our project already exists) in the project with our technologies, the application still seems to work, but I don't see anything except the title, when I start the application. When I look at the page sourcecode in the browser, everything seems fine. From the tutorial application, I have also copied the theme into the new one, but still, it didn't work. I have also generated the code (which creates the "VAADIN" directory in the WebContent directory and the standard widgets, etc.).

I have also started the project in debug mode. All the code in the AddressBook application is executed and the application is returning without errors or exceptions.

The difference, between the new Vaadin Project and the integration in our framework is the following:
- We are using/loading the standard filters in web.xml for Spring and Struts2
-- Example: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter --> location "/*"
-- Example: org.springframework.web.context.ContextLoaderListener
-- and some other filters that we need

For Vaadin, I have the following configuration in web.xml

<!-- VAADIN: BEGIN -->
  <servlet>
  	<servlet-name>TestApplication</servlet-name>
  	<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
  	<init-param>
  		<description>Vaadin application class to start</description>
  		<param-name>application</param-name>
  		<param-value>de.test.vaadin.servlet.TestApplication</param-value>
  	</init-param>
  	<init-param>
  		<description>
  		Application widgetset</description>
  		<param-name>widgetset</param-name>
  		<param-value>de.test.vaadin.servlet.widgetset.WebappWidgetset</param-value>
  	</init-param>
  </servlet>
  <servlet-mapping>
	<servlet-name>TestApplication</servlet-name>
	<url-pattern>/test/*</url-pattern>
  </servlet-mapping>
  <!-- VAADIN: END -->

Now the question is, why do I not see anything, when the application is integrated into our project?
Do you have an answer?

I think Vaadin is great and I realy want to make it work with our framework.
Any help will be great.

Thanks,
Aladdin

Aladdin Özenir
1 decade ago Mar 19, 2010 10:54am

Hello again,

I have found out the problem and its solution.
It was not the integration Struts2 and Vaadin.

Even if I had the correct Sourcecode in the Browser, I didn't have the correct Sylesheets for the AddressBook applications' components.
First, I was expecting Vaadin to display the fields/components without any style. But, I think because of the strong JavaScript usage, it's just necessary to have the correct stylesheets (CSS files).

To solve the problem, I have copied the standard "themes" folder provided by a demo application and suddenly it worked. These themes have some standard class definitions for the components.

ashlon hill
1 decade ago Sep 13, 2010 4:22pm
Aladdin Özenir
1 decade ago Sep 15, 2010 9:25am

Hi,

I just copied the themes folder from a demo application into my application.
These wonderful themes are included in Vaadin.

The screenshot shows my webcontent structure. I hope this helps.
I have many themes in my application. I wanted to test all of them. ;)
It is sufficient, if you have the base theme and for example reindeer.

Last updated on Sep, 15th 2010