I do not know how to setup web.xml,myproject.gwt.xml, and spring-servlet.xml to integrate gwt and spring framework. i was following this link and i got this issue integrating gwt and spring
this is myproject.gwt.xml
<module rename-to='ZzSampleGWT204Project'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<entry-point class='de.mxro.zz.zzsamplegwt204project.client.ZzSampleGWT204Project'/>
<servlet path='/myService' class='de.mxro.zz.zzsamplegwt204project.server.MyServiceImpl'/>
<source path='client'/>
<source path='shared'/>
</module>
this is my web.xml file `
<!-- Servlets -->
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>myService</servlet-name>
<servlet-class>de.mxro.zz.zzsamplegwt204project.server.MyServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/ZzSampleGWT204Project/*</url-pattern>
</servlet-mapping>
</web-app>
and this is my spring-servelt.xml file for spring servelet which defined above.
<beans>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="urlMap">
<map>
<entry key="myService">
<ref bean="ServiceController"/>
</entry>
</map>
</property>
</bean>
<bean id="ServiceController" class="de.mxro.zz.zzsamplegwt204project.server.ServletWrappingController">
<property name="servletName" value="myService"/>
<property name="servletInstance"><ref bean="myService"/>
</property>
</bean>
<bean id="myService" class="de.mxro.zz.zzsamplegwt204project.server.MyServiceImpl">
</bean>
`
this is onModuleLoad method
public void onModuleLoad() {
final Label label = new Label("this is a label");
final MyServiceAsync svc = (MyServiceAsync)GWT.create(de.mxro.zz.zzsamplegwt204project.client.MyService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) svc;
endpoint.setServiceEntryPoint("services/myService");
final AsyncCallback callback = new AsyncCallback() {
public void onSuccess(Object result) {
label.setText(result.toString());
}
public void onFailure(Throwable ex) {
label.setText(ex.toString());
}
};
Button button = new Button("Click ME", new ClickHandler() {
public void onClick(ClickEvent arg0) {
svc.myMethod("Do Something", callback);
}
});
RootPanel.get(null).add(button);
}
please let me know where i am wrong?
I would be happy if anyone can provide me a very simple project which shows how to integrate gwt and spring (MVC, Security) together.
Thanks Bahador Biglari
I assume that you can't get the module to do anything, considering you provided no stack trace? You should make sure that whatever HTML file you're working in, that you've actually loaded the GWT module into the page:
<script type="text/javascript" language="javascript" src="stockwatcher/stockwatcher.nocache.js"></script>
Also, you should think about using Eclipse if you aren't already. Eclipse makes debugging, compiling, and modifying Java GWT code a lot easier.
Look at this tutorial to at least get the GWT application itself working:
http://code.google.com/webtoolkit/doc/1.6/tutorial/create.html