【技术心得】如何让GWT运行在Tomcat中
OK got it running on Tomcat. Here are the steps
1. Strip the javax.* packages from gwt-user.jar . You can do it with
winzip/winrar etc. Open the jar in such tools and delete all files in
javax folder including the folder
2. Copy the stripped jar in your webapps/YourApp/WEB-INF/lib. Copy the
compiled classes (e.g copy the folder "com" in samples/dynatable/bin )
to webapps/YourApp/WEB-INF/classes
3. Modify your Service Entry point code (if required). Note the text
you put in place /calendar line. You will use this text in web.xml
later
ServiceDefTarget target = (ServiceDefTarget) calService;
String staticResponseURL = GWT.getModuleBaseURL();
staticResponseURL += "/YourApp/calendar";
target.setServiceEntryPoint(staticResponseURL);
4. Run DynaTable-compile.cmd (replace dynatable with app name). File
will be generated in www\com.google.gwt.sample.dynatable.DynaTable\ .
Copy all files within this folder to webapps/YourApp/
5. Create modify web.xml and place it in WEB-INF
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<servlet>
<servlet-name>SchoolCalendarService</servlet-name>
<servlet-class>com.google.gwt.sample.dynatable.server.SchoolCalendarService-Impl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SchoolCalendarService</servlet-name>
<url-pattern>/calendar</url-pattern>
</servlet-mapping>
</web-app>
5. Launch tomcat. Open browser e.g.
localhost:8080/YourApp/DynaTable.html
6. Enjoy

2 条评论:
goood job弄的满头包的问题,原来是要自己动手删除里头的javax
开发的时候 如何用tomcat代替 jetty呢
直接用tomcat的 xml配置以后,只有html和css的更改才能体现出来,对于java文件更改后,只有编译后才能显示,有什么办法吗,如果 知道麻烦回复我一下到我email:koujun1986@gmail.com谢谢
发表评论