Hello all,
I try to build a project in maven and gwt with server side.
so i select to use a gwt-maven-plugin archetype as a maven project .
here is my app :
public class Application implements EntryPoint
{
public void onModuleLoad()
{
final Button button = new Button();
final Label label = new Label("only for test");
button.addClickHandler(new ClickHandler()
{
public void onClick(ClickEvent arg0)
{
GetStringServiceAsync service = (GetStringServiceAsync)
GWT.create(GetStringService.class);
service.getString("1", "2",new AsyncCallback<String>()
{
public void onSuccess(String
res)
{
label.setText(res);
}
public void onFailure(Throwable
arg0)
{
label.setText("Error
Connection");
}
});
}
});
RootPanel.get().add(button);
RootPanel.get().add(label);
}
}
server interface :
public interface GetStringService extends RemoteService
{
public String getString(String name, String pass);
}
public interface GetStringServiceAsync
{
void getString(String name,String pass,AsyncCallback<String>
callback );
}
server Impi..
@SuppressWarnings("serial")
public class GetStringImpl extends RemoteServiceServlet implements
GetStringService
{
public String getString(String name, String pass)
{
return "Hello every body ...";
}
}
POM file :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://
maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
POM generated by gwt-maven-plugin archetype
-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.hp.bsrm</groupId>
<artifactId>ttt</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<!-- convenience to define GWT version in one place -->
<gwt.version>2.0.0</gwt.version>
<!-- tell the compiler we can use 1.5 -->
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
<dependencies>
<!-- GWT dependencies (from central repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>com.hp.bsrm.ttt.Application/Application.html</
runTarget>
</configuration>
</plugin>
<!--
If you want to use the target/web.xml file mergewebxml
produces,
tell the war plugin to use it.
Also, exclude what you want from the final artifact here.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>target/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.19</version>
<configuration>
<webAppConfig>
<baseResource
implementation="org.mortbay.resource.ResourceCollection">
<!-- Workaround for Maven/Jetty issue
http://jira.codehaus.org/browse/JETTY-680 -->
<resources>src/main/webapp,$
{project.build.directory}/${project.build.finalName}</resources>
<!-- <resourcesAsCSV>src/main/webapp,$
{project.build.directory}/${project.build.finalName}</resourcesAsCSV>
-->
</baseResource>
</webAppConfig>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
web.xml file :
<?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>
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>com.hp.bsrm.ttt.server.GreetingServiceImpl</servlet-
class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/ttt/greet</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>Ttt.html</welcome-file>
</welcome-file-list>
</web-app>
I try to run the project in debug mode , when i try to get to server
the project fielad
please me.
thanks
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.